Require msgcat before initialising ttkbootstrap

This commit is contained in:
lm 2025-10-17 12:59:39 +02:00
parent 317220c290
commit 3aa0d7c5b4
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ class ThemeMixin:
def init_theme(self) -> None:
"""Initialise ttk style handling and apply the detected theme."""
if HAS_TTKBOOTSTRAP:
try:
# Ensure msgcat package is available before ttkbootstrap initialises translations
self.root.tk.call("package", "require", "msgcat") # type: ignore[attr-defined]
except Exception:
pass
self.style = tb.Style()
self.using_tb = True
else: