mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
darkdetct
This commit is contained in:
parent
cf7242ef06
commit
87df764002
@ -6,7 +6,7 @@ if sys.platform == "darwin":
|
|||||||
try:
|
try:
|
||||||
import darkdetect
|
import darkdetect
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
sys.stderr.write(e + "\nYou have to install darkdetect: pip install darkdetect")
|
sys.stderr.write(str(e) + "\nERROR: You have to install darkdetect: pip install darkdetect\n")
|
||||||
|
|
||||||
|
|
||||||
class SystemAppearanceModeListener(Thread):
|
class SystemAppearanceModeListener(Thread):
|
||||||
@ -36,9 +36,12 @@ class SystemAppearanceModeListener(Thread):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def detect_appearance_mode():
|
def detect_appearance_mode():
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
if darkdetect.theme() == "Dark":
|
try:
|
||||||
return 1 # Dark
|
if darkdetect.theme() == "Dark":
|
||||||
else:
|
return 1 # Dark
|
||||||
|
else:
|
||||||
|
return 0 # Light
|
||||||
|
except NameError:
|
||||||
return 0 # Light
|
return 0 # Light
|
||||||
else:
|
else:
|
||||||
return 0 # Light
|
return 0 # Light
|
||||||
@ -70,9 +73,12 @@ class SystemAppearanceModeListenerNoThread():
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def detect_appearance_mode():
|
def detect_appearance_mode():
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
if darkdetect.theme() == "Dark":
|
try:
|
||||||
return 1 # Dark
|
if darkdetect.theme() == "Dark":
|
||||||
else:
|
return 1 # Dark
|
||||||
|
else:
|
||||||
|
return 0 # Light
|
||||||
|
except NameError:
|
||||||
return 0 # Light
|
return 0 # Light
|
||||||
else:
|
else:
|
||||||
return 0 # Light
|
return 0 # Light
|
||||||
|
Loading…
Reference in New Issue
Block a user