changing the color of the title bar? #1011
Replies: 4 comments 7 replies
-
You are Talking about this Title Bar of the tkinter windows ? |
Beta Was this translation helpful? Give feedback.
-
@clear-code-projects I think that is possible using the DWM Api from the Btw I reallay enjoy your videos :) |
Beta Was this translation helpful? Give feedback.
-
If you are talking about the window title:
or
it is built in |
Beta Was this translation helpful? Give feedback.
-
@clear-code-projects Here is the final result:CODEimport customtkinter
from ctypes import windll, byref, sizeof, c_int
root = customtkinter.CTk()
root.update()
HWND = windll.user32.GetParent(root.winfo_id()) # the window we want to change
"""
DWMWA_ATTRIBUTES (for windows 11 title bar)
CAPTION COLOR (HEADER) = 35
BORDER COLOR = 34
TITLE COLOR = 36
"""
DWMWA_ATTRIBUTE = 35
COLOR = 0x00FF0000 # color should be in hex order: 0x00bbggrr
windll.dwmapi.DwmSetWindowAttribute(HWND, DWMWA_ATTRIBUTE, byref(c_int(COLOR)), sizeof(c_int))
root.mainloop() Make sure that the color can be customized based on the hex values in this order: You can also customize other parameters like border color, title color and get a final look like this: Other themes can also be applied like the mica one: That's all I found. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi, I wonder if it is possible to change the title of the titlebar? I couldn't find an answer in the documentation but since it is different from the default maybe there is a way to do it easily?
(would be a really good feature, by the way)
Beta Was this translation helpful? Give feedback.
All reactions