#Recolouring the title bar on a CTk (CustomTkinter) window

7 messages · Page 1 of 1 (latest)

solemn yacht
#

As the title says, I would appreciate some help recolouring the titlebar on a CustomTkinter window in python. I would much prefer to not replace the original object and use a canvas and buttons to rebuild it as it loses some core functionality and doesn't look as good in my opinion. I have also already tried using the 'ctypes' module as an alternative, as recommended by stack overflow, however it does not appear to change anything. All help is appreciated!

smoky river
#

if u really mean the titel bar from the window, you cant change the look of it. its os build.

You can work around with removing it and building the functionality yourself
but maybe resize & drag functionality get lost

solemn yacht
#

I hopede there would be a solution given that the title bar already differs between light and dark mode, anyway, thanks for letting me know so I didn't just sit there struggling for a few more hours haha

smoky river
#

just took me 2 mins googeling to be honesr ;D

solemn yacht
#

I spent hours trying to find anything I could, might have no choice though:(

smoky river
solemn yacht
#

I have found the solution! I found the "py-window-styles" module on github, the command to change the style is easy too! to install it just simply type "pip install pywinstyles" in your terminal.
here's an example usage:

import pywinstyles
import customtkinter as ctk

root = ctk.CTk()
pywinstyles.change_header_color(root, color="#00524d")

root.mainloop()