darkdetct

This commit is contained in:
Tom Schimansky 2021-03-06 13:47:49 +01:00
parent d81c1a3ead
commit cf7242ef06
3 changed files with 8 additions and 5 deletions

View File

@ -22,7 +22,7 @@ def enable_macos_darkmode():
sys.stderr.write("WARNING (customtkinter.enable_macos_darkmode): " +
"This command forces macOS dark-mode on all programs." +
"This can cause bugs on some other programs.\n" +
"Disable it by calling customtkinter.disable_macos_darkmode at the end of the program.\n")
"Disable it by calling customtkinter.disable_macos_darkmode() at the end of the program.\n")
else:
sys.stderr.write("WARNING (customtkinter.enable_macos_darkmode): " +
"Currently this works only with anaconda python version (Tcl/Tk >= 8.6.9).\n" +
@ -58,7 +58,7 @@ def deactivate_threading():
AppearanceModeTracker.init_listener_function(no_thread=True)
sys.stderr.write("WARNING (customtkinter.deactivate_threading): Automatic threaded search for a change of the " +
"system appearance mode is deativated now.\nYou have to update the appearance mode manually " +
"in your mainloop by calling customtkinter.update_theme() every time.\n")
"in your mainloop by calling customtkinter.update_appearance_mode() every time.\n")
def activate_threading():

View File

@ -1,8 +1,13 @@
from threading import Thread
from time import sleep
import darkdetect
import sys
if sys.platform == "darwin":
try:
import darkdetect
except ImportError as e:
sys.stderr.write(e + "\nYou have to install darkdetect: pip install darkdetect")
class SystemAppearanceModeListener(Thread):
""" This class checks for a system appearance change

View File

@ -16,8 +16,6 @@ class CTkColorManager:
cls.MAIN = (hex_color, hex_color)
cls.MAIN_HOVER = (hex_color_hover, hex_color_hover)
print(CTkColorManager.MAIN, id(CTkColorManager))
@classmethod
def set_theme(cls, main_color):
if main_color.lower() == "green":