I'm trying to make my app written in python with a Tkinter GUI to change dependant on whether the device is in light or dark mode. I can't seem to change the colour of each label in tk.
Here is my code so far:
def monitor_changes():
registry = ConnectRegistry(None, HKEY_CURRENT_USER)
key = OpenKey(registry, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize')
mode = QueryValueEx(key, "AppsUseLightTheme")
tk.config(bg="#f0f0f0" if mode[0] else "black")
tk.after(100,monitor_changes)
for Label in tk:
if mode[0]:
Label.config(bg="#f0f0f0")
else:
Label.config(bg="black")
monitor_changes()