For my application, I'd like the native customkinter bar to change color and the text color too. I found a lot of weird libraries that did this, but it didn't work. For your information, because it's important to my problem, my operating system is Window10.
To help you with my problem, I'll give you the code for the initialization method of my class:
import customkinter
class FenetreLogin(customtkinter.CTk):
def __init__(self):
super().__init__();
self.geometry("700x680");
self.title("Exportation_Fanny v1");
self.initial_width = 650;
labelAuteur = customtkinter.CTkLabel(master=self,font=("",20,'underline'),text="Made By Lucas Desperrois");
labelAuteur.pack(anchor="n",pady=10)
self.resizable(width=False,height=False)
self.fenetreConnexion = self.frameConnexion();
self.browser1=None;
This is what I use:
import customtkinter as ctk
import os
from ctypes import byref, c_int, sizeof, windll
class App(ctk.CTk):
def __init__ (self):
super().__init__()
self.title("")
try:
self.iconbitmap(os.path.join(os.path.dirname(__file__), "images/empty.ico")) # an empty icon
except:
pass
# change the title bar color to a discord like color #5662f6
self.title_bar_color("#5662f6")
def title_bar_color(self, hexcolor):
color = '0x00'
for i in range(7,0,-2):
h = hexcolor[i:i+2]
color = color+h
windll.dwmapi.DwmSetWindowAttribute(
windll.user32.GetParent(self.winfo_id()),
35,
byref(c_int(int(color, 16))),
sizeof(c_int)
)
if __name__ == "__main__":
app = App()
app.mainloop()
Now for this code to work, you need to do 2 things: