Reference¶
-
class
ttkthemes.themed_style.
ThemedStyle
(*args, **kwargs)[source]¶ Bases:
ttk.Style
,ttkthemes._widget.ThemedWidget
Style that supports setting the theme for a Tk instance. Can be used as a drop-in replacement for normal ttk.Style instances. Supports the themes provided by this package.
-
__init__
(*args, **kwargs)[source]¶ Parameters: theme – Theme to set up initialization completion. If the theme is not available, fails silently.
-
-
class
ttkthemes.themed_tk.
ThemedTk
(*args, **kwargs)[source]¶ Bases:
Tkinter.Tk
,ttkthemes._widget.ThemedWidget
Tk child class that supports the themes supplied in this package
A theme can be set upon initialization or during runtime. Can be used as a drop-in replacement for the normal Tk class. Additional options:
- Initial theme
theme
: Sets the initial theme to the theme specified. If the theme is not available, fails silently (there is no indication that the theme is not set other than it not appearing to the user). - Toplevel background color
toplevel
: Hooks into the Toplevel.__init__ function to set a default window background color in the options passed. The hook is not removed after the window is destroyed, which is by design because creating multiple Tk instances should not be done in the first place. - Tk background color
themebg
: Set the default background color of a Tk window to the default theme background color. For example: The background of windows may take on a dark color for dark themes. Backwards-compatible with thebackground
keyword argument of v2.3.0 and earlier. - GIF theme override
gif_override
: Forces ttkthemes to load the GIF version of themes that also provide a PNG version even if the PNG version can be loaded. Can only be set at object initialization. GIF themes may provide a higher UI performance than other themes.
-
__init__
(*args, **kwargs)[source]¶ Parameters: - theme – Theme to set upon initialization. If theme is not available, fails silently.
- toplevel – Control Toplevel background color option, see class documentation for details.
- themebg – Control Tk background color option, see class documentation for details.
- fonts – Whether to enable the automatic change of default font selected for a theme
- Initial theme
-
class
ttkthemes._widget.
ThemedWidget
(tk_interpreter, gif_override=False)[source]¶ Bases:
object
Provides functions to manipulate themes in order to reduce code duplication in the ThemedTk and ThemedStyle classes.
-
__init__
(tk_interpreter, gif_override=False)[source]¶ Initialize attributes and call _load_themes
Parameters: - tk_interpreter – tk interpreter for tk.Widget that is being initialized as ThemedWidget. Even if this Widget is just a single widget, the changes affect all widgets with the same parent Tk instance.
- gif_override – Force loading of GIF-themes even if PNG-themes can be loaded
-
current_theme
¶ Property to get the currently enabled theme
-
set_theme
(theme_name)[source]¶ Set new theme to use. Uses a direct tk call to allow usage of the themes supplied with this package.
Parameters: theme_name – name of theme to activate
-
set_theme_advanced
(theme_name, brightness=1.0, saturation=1.0, hue=1.0, preserve_transparency=True, output_dir=None, advanced_name='advanced')[source]¶ Load an advanced theme that is dynamically created
Applies the given modifiers to the images of the theme given and then creates a theme from these new images with the name ‘advanced’ and then applies this theme. Is not available without support for PNG-based themes, then raises RuntimeError.
-
themes
¶ Property alias of get_themes()
-