Styles¶
The appearance of many of the gui components (also known as widgets) are highly configurable. There are three ways to alter the style of the interface
Use the default style. This will affect every single widget, even ones that have already been created.
style = gui.get_default_style() style.bg_color = "blue"
Use a custom style. This allows you to customize individual widgets or groups of widgets
custom_style = gui.Style(button_text_font_size = 12) button1 = gui.Button((50,50),(80,80),label="Small text",style=custom_style) button2 = gui.Button((150,50),(80,80),label="Small again",style=custom_style) button3 = gui.Button((250,50),(80,80),label="OK")
Custom made styles will all inherit the default settings, so you only need to specify those items that need to be altered
Update a pre-existing style. This allows you to use a pre-existing style and only change those attributes which need to be changed
my_new_style = my_old_style.copy(bg_color="teal")
Styles can be updated dynamically, even after the widget has been created
-
class
Style
(**kwargs)¶ Parameters: **kwargs – specify style attributes as required Returns: A new Style with attributes set as per kwargs, all others are as per default settings -
copy
(self, **kwargs)¶ Parameters: **kwars – specify style attributes to update as required Returns: A new Style with attributes set as per kwargs, all others are as per the original style.
-
-
get_default_style
()¶ Returns: The default style.