diff --git a/customtkinter/windows/widgets/theme/__init__.py b/customtkinter/windows/widgets/theme/__init__.py index bd7395a..8931f35 100644 --- a/customtkinter/windows/widgets/theme/__init__.py +++ b/customtkinter/windows/widgets/theme/__init__.py @@ -4,6 +4,6 @@ from .theme_manager import ThemeManager try: ThemeManager.load_theme("blue") except FileNotFoundError as err: - raise FileNotFoundError(f"{err}\n\nThe .json theme file for CustomTkinter could not be found.\n" + + raise FileNotFoundError(f"{err}\nThe .json theme file for CustomTkinter could not be found.\n" + f"If packaging with pyinstaller was used, have a look at the wiki:\n" + f"https://github.com/TomSchimansky/CustomTkinter/wiki/Packaging#windows-pyinstaller-auto-py-to-exe") diff --git a/customtkinter/windows/widgets/theme/theme_manager.py b/customtkinter/windows/widgets/theme/theme_manager.py index e04b679..f871d49 100644 --- a/customtkinter/windows/widgets/theme/theme_manager.py +++ b/customtkinter/windows/widgets/theme/theme_manager.py @@ -1,5 +1,6 @@ import sys import os +import pathlib import json from typing import List, Union @@ -15,7 +16,8 @@ class ThemeManager: script_directory = os.path.dirname(os.path.abspath(__file__)) if theme_name_or_path in cls._built_in_themes: - with open(os.path.join(script_directory, "../../../assets", "themes", f"{theme_name_or_path}.json"), "r") as f: + customtkinter_path = pathlib.Path(script_directory).parent.parent.parent + with open(os.path.join(customtkinter_path, "assets", "themes", f"{theme_name_or_path}.json"), "r") as f: cls.theme = json.load(f) else: with open(theme_name_or_path, "r") as f: