3.3.2. Stage¶
When the system is initialized, a stage object of the Stage class is automatically created, which can be used directly without the need for users to create it themselves.
-
stage.
add_widget
(widget_obj)¶ Description: Adds the controls in the parameter to the UI 参数: widget_obj (object) – Control objects to be added to the UI 返回: None Example:
1 2 3 4 | #Create a Button object and add it to the UI
my_button = Button()
stage.add_widget(my_button)
|
-
stage.
remove_widget
(widget_obj)¶ Description: Removes the controls of the parameter from the UI 参数: widget_obj (object) – The controls that need to be removed from the UI 返回: None Example: stage.remove_widget(my_button)
Example description: Remove the my_button control from the UI