mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed platform independant path for theme loading #1498
This commit is contained in:
parent
2ee496ed28
commit
121f5713a8
@ -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")
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user