You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rdbende,
I have a function that can switch the theme based on the windows theme. For example, if Windows is in dark mode, the theme of the app will be in dark mode too. the code for this function is based on your change theme function. the code for this function is as follows:
importctypesasctimportdarkdetectdefsettheme(window):
window.tk.call("source", "azure.tcl")
window.tk.call("set_theme", "light")
defdark_title_bar(window):
""" MORE INFO: https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute """window.update()
DWMWA_USE_IMMERSIVE_DARK_MODE=20set_window_attribute=ct.windll.dwmapi.DwmSetWindowAttributeget_parent=ct.windll.user32.GetParenthwnd=get_parent(window.winfo_id())
rendering_policy=DWMWA_USE_IMMERSIVE_DARK_MODEvalue=2value=ct.c_int(value)
set_window_attribute(hwnd, rendering_policy, ct.byref(value), ct.sizeof(value))
defchange_theme():
# NOTE: The theme's real name is azure-<mode>ifwindow.tk.call("ttk::style", "theme", "use") =="azure-dark":
# Set light themewindow.tk.call("set_theme", "light")
else:
# Set dark themewindow.tk.call("set_theme", "dark")
is_dark=darkdetect.isDark()
ifis_dark:
change_theme()
dark_title_bar(window)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Rdbende,
I have a function that can switch the theme based on the windows theme. For example, if Windows is in dark mode, the theme of the app will be in dark mode too. the code for this function is based on your change theme function. the code for this function is as follows:
Beta Was this translation helpful? Give feedback.
All reactions