Fallback to classic ttk when ttkbootstrap fails
This commit is contained in:
parent
3aa0d7c5b4
commit
923b773ee4
|
|
@ -31,12 +31,16 @@ class ThemeMixin:
|
||||||
"""Initialise ttk style handling and apply the detected theme."""
|
"""Initialise ttk style handling and apply the detected theme."""
|
||||||
if HAS_TTKBOOTSTRAP:
|
if HAS_TTKBOOTSTRAP:
|
||||||
try:
|
try:
|
||||||
# Ensure msgcat package is available before ttkbootstrap initialises translations
|
try:
|
||||||
self.root.tk.call("package", "require", "msgcat") # type: ignore[attr-defined]
|
self.root.tk.call("package", "require", "msgcat") # type: ignore[attr-defined]
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
self.style = tb.Style()
|
||||||
|
self.using_tb = True
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
self.style = ttk.Style()
|
||||||
self.style = tb.Style()
|
self.style.theme_use("clam")
|
||||||
self.using_tb = True
|
self.using_tb = False
|
||||||
else:
|
else:
|
||||||
self.style = ttk.Style()
|
self.style = ttk.Style()
|
||||||
self.style.theme_use("clam")
|
self.style.theme_use("clam")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue