diff --git a/theme.py b/theme.py index a7f9df34..ff3df4b2 100644 --- a/theme.py +++ b/theme.py @@ -115,6 +115,7 @@ elif sys.platform == 'linux': class _Theme(object): def __init__(self): + self.ttk_style = None self.active = None # Starts out with no theme self.minwidth = None self.widgets = {} @@ -184,6 +185,10 @@ class _Theme(object): for child in widget.winfo_children(): self.register(child) + # This class is an import-time singleton, so can't do this in __init__ + # as tkinter won't have been at all set up by then. + self.ttk_style = ttk.Style() + def register_alternate(self, pair, gridopts): self.widgets_pair.append((pair, gridopts)) @@ -431,6 +436,16 @@ class _Theme(object): self.minwidth = root.winfo_width() # Minimum width = width on first creation root.minsize(self.minwidth, -1) + ####################################################################### + # Update our ttk.Style + # + # Ref: + # Ref: + ###################################################################### + self.ttk_style.configure('TSizegrip', background=self.current['background']) + self.ttk_style.configure('TSizegrip', foreground=self.current['foreground']) + ####################################################################### + # singleton theme = _Theme()