Documentation¶
-
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:
- Toplevel background color: toplevel
If True,
ThemedTk
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: background
If True, sets the background color of the Tkinter window to the
default TFrame background color specified by the theme. For a
custom background color, the
bg
alias can still be used.
- Toplevel background color: toplevel
If True,
-
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
-
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()
-