fixed platform independant path for theme loading #1498

This commit is contained in:
Tom Schimansky
2023-04-24 13:37:17 +02:00
parent 2ee496ed28
commit 121f5713a8
2 changed files with 4 additions and 2 deletions

View File

@@ -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: