Replies: 2 comments
-
Another way to get a windows native dark title bar:import customtkinter
from ctypes import POINTER, pointer, sizeof, windll, Structure
from ctypes.wintypes import DWORD, ULONG
customtkinter.set_appearance_mode("Dark")
class ACCENT_POLICY(Structure):
_fields_ = [
('AccentState', DWORD),
('AccentFlags', DWORD),
('GradientColor', DWORD),
('AnimationId', DWORD),
]
class WINDOW_COMPOSITION_ATTRIBUTES(Structure):
_fields_ = [
('Attribute', DWORD),
('Data', POINTER(ACCENT_POLICY)),
('SizeOfData', ULONG),
]
def ChangeAccent(hWnd):
accentPolicy = ACCENT_POLICY()
winCompAttrData = WINDOW_COMPOSITION_ATTRIBUTES()
winCompAttrData.Attribute = 30
winCompAttrData.SizeOfData = sizeof(accentPolicy)
winCompAttrData.Data = pointer(accentPolicy)
accentPolicy.AccentState = 1
windll.user32.SetWindowCompositionAttribute(hWnd, pointer(winCompAttrData))
root = customtkinter.CTk()
HWND = windll.user32.GetParent(root.winfo_id())
ChangeAccent(HWND)
root.mainloop() |
Beta Was this translation helpful? Give feedback.
0 replies
-
Acrylic Themeimport customtkinter
from ctypes import POINTER, pointer, sizeof, windll, Structure, byref, c_int
from ctypes.wintypes import DWORD, ULONG
class ACCENT_POLICY(Structure):
_fields_ = [
('AccentState', DWORD),
('AccentFlags', DWORD),
('GradientColor', DWORD),
('AnimationId', DWORD),
]
class WINDOW_COMPOSITION_ATTRIBUTES(Structure):
_fields_ = [
('Attribute', DWORD),
('Data', POINTER(ACCENT_POLICY)),
('SizeOfData', ULONG),
]
def ChangeAccent(hWnd: int, Color):
accentPolicy = ACCENT_POLICY()
winCompAttrData = WINDOW_COMPOSITION_ATTRIBUTES()
winCompAttrData.Attribute = 19
winCompAttrData.SizeOfData = sizeof(accentPolicy)
winCompAttrData.Data = pointer(accentPolicy)
accentPolicy.AccentState = 4 # also try 6 for glass, 1 for accent
accentPolicy.GradientColor = Color
windll.user32.SetWindowCompositionAttribute(hWnd, pointer(winCompAttrData))
root = customtkinter.CTk()
HWND = windll.user32.GetParent(root.winfo_id())
color = 0x101010 # rgb order: 0xbbggrr
ChangeAccent(HWND, color)
root.mainloop() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Try this: pywinstyles
Manual Settings if you need:
Apply the Mica theme
Apply the Aero Theme
Custom colors
Beta Was this translation helpful? Give feedback.
All reactions