diff --git a/customtkinter/__init__.py b/customtkinter/__init__.py index c30719c..75402dd 100644 --- a/customtkinter/__init__.py +++ b/customtkinter/__init__.py @@ -1,3 +1,5 @@ +__version__ = "1.1" + from .customtkinter_button import CTkButton from .customtkinter_slider import CTkSlider from .customtkinter_frame import CTkFrame diff --git a/customtkinter/appearance_mode_tracker.py b/customtkinter/appearance_mode_tracker.py index d76d6c9..5598eb4 100644 --- a/customtkinter/appearance_mode_tracker.py +++ b/customtkinter/appearance_mode_tracker.py @@ -1,12 +1,13 @@ from threading import Thread from time import sleep import sys +from distutils.version import StrictVersion as Version +import darkdetect -if sys.platform == "darwin": - try: - import darkdetect - except ImportError as e: - sys.stderr.write(str(e) + "\nERROR: You have to install darkdetect: pip install darkdetect\n") +if Version(darkdetect.__version__) < Version("0.3.1"): + sys.stderr.write("WARNING: You have to update the darkdetect library: pip3 install --upgrade darkdetect\n") + if sys.platform != "darwin": + exit() class SystemAppearanceModeListener(Thread): @@ -35,15 +36,12 @@ class SystemAppearanceModeListener(Thread): @staticmethod def detect_appearance_mode(): - if sys.platform == "darwin": - try: - if darkdetect.theme() == "Dark": - return 1 # Dark - else: - return 0 # Light - except NameError: + try: + if darkdetect.theme() == "Dark": + return 1 # Dark + else: return 0 # Light - else: + except NameError: return 0 # Light def run(self): @@ -72,15 +70,12 @@ class SystemAppearanceModeListenerNoThread(): @staticmethod def detect_appearance_mode(): - if sys.platform == "darwin": - try: - if darkdetect.theme() == "Dark": - return 1 # Dark - else: - return 0 # Light - except NameError: + try: + if darkdetect.theme() == "Dark": + return 1 # Dark + else: return 0 # Light - else: + except NameError: return 0 # Light def update(self): diff --git a/examples/simple_example.py b/examples/simple_example.py index 087a572..766cb27 100644 --- a/examples/simple_example.py +++ b/examples/simple_example.py @@ -1,8 +1,8 @@ import tkinter import customtkinter # <- import the CustomTkinter module -customtkinter.enable_macos_darkmode() -customtkinter.set_appearance_mode("System") # Other: "Dark", "Light" +#customtkinter.enable_macos_darkmode() +#customtkinter.set_appearance_mode("System") # Other: "Dark", "Light" root_tk = tkinter.Tk() # create the Tk window like you normally do root_tk.geometry("400x240") diff --git a/examples/simple_example_images.py b/examples/simple_example_images.py index 911eec1..e6dbe0c 100644 --- a/examples/simple_example_images.py +++ b/examples/simple_example_images.py @@ -1,9 +1,9 @@ import tkinter import customtkinter # <- import the CustomTkinter module -from PIL import Image, ImageTk # <- import PIL for the images +#from PIL import Image, ImageTk # <- import PIL for the images -customtkinter.enable_macos_darkmode() -customtkinter.set_appearance_mode("System") # Other: "Dark", "Light" +#customtkinter.enable_macos_darkmode() +#customtkinter.set_appearance_mode("System") # Other: "Dark", "Light" root_tk = tkinter.Tk() # create the Tk window like you normally do root_tk.geometry("400x240") diff --git a/setup.py b/setup.py index 452ee66..118b840 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ def read(filename): setup(name="customtkinter", - version="1.0", + version="1.1", author="Tom Schimansky", license="Creative Commons Zero v1.0 Universal", url="https://github.com/TomSchimansky/CustomTkinter",