I have a custom titlebar for my password generator application, however, it seems like ttkbootstrap is applying its darkly theme to the minimize and close buttons when it shouldn’t. How do I make it not do this?
I’ve figured that my problem is happening because my method to create the titlebar for my application calls the root window as the titlebar’s parent window, making ttkbootstrap apply itself to the titlebar.
Titlebar creation method:
def create_titlebar(self):
bg_color = "#222222"
self.title_bar = titlebar(self.root, "PyPass", bg_color)
self.title_bar.pack(fill=X)
Titlebar UI elements (code of only the butttons being created, not the entire method):
def __init__(self, parent, app_title, bg_color, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
# Title label
self.title_label = tk.Label(self.title_bar_frame, text=self.app_title, bg=self.bg_color, fg="white")
self.title_label.pack(side=tk.LEFT, padx=5)
# Close button
self.close_button = tk.Button(self.title_bar_frame, text="✕", bg=self.bg_color, fg="white", activebackground="gray10", activeforeground="white", highlightbackground=self.bg_color, highlightcolor=self.bg_color, relief=tk.FLAT, command=self.close_window)
self.close_button.pack(side=tk.RIGHT)
self.close_button.bind("<Enter>", self.on_button_hover)
self.close_button.bind("<Leave>", self.on_button_leave)
# Minimize button
self.minimize_button = tk.Button(self.title_bar_frame, text="―", bg=self.bg_color, fg="white", activebackground="gray10", activeforeground="white", highlightbackground=self.bg_color, highlightcolor=self.bg_color, relief=tk.FLAT, command=self.minimize_window)
self.minimize_button.pack(side=tk.RIGHT)
self.minimize_button.bind("<Enter>", self.on_button_hover)
self.minimize_button.bind("<Leave>", self.on_button_leave)