0

Most applications have a customised title bar, take VSC for example: Vsc title bar See all the button and custom colour. All I want to do is change the colour to any colour, not just black like in this post (second answer). I am using windows 11, python 3.12.9.

I haven't tried anything yet because I have no idea where to start from! If it helps, I am building it using pyinstaller and mabye I could change it after it has been built?

Thanks in advance!

0

1 Answer 1

3

You can use the pywinstyles module for doing that.

First, install it with the following command:

pip install pywinstyles

Then, you can change the color of the title bar using the change_header_color() function from pywinstyles like this:

import tkinter as tk, pywinstyles

window = tk.Tk()

# Change the title bar color
pywinstyles.change_header_color(window, "#987654")

window.mainloop()

Here's the result:

tkinter window with custom title bar color

Please note that this will only work on Windows 11. If you want to change the title bar color on other Windows versions, you should consider creating your own title bar and hiding the one provided by the system.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much much, it works perfelctly!
@LucaHeyworth You're welcome! Don't forget to mark this answer as accepted. You can do that by clicking on the checkmark button.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.