TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.57k stars 1.08k forks source link

Fullscreen mode and set_appearance_mode #1930

Open OddUnicorn opened 1 year ago

OddUnicorn commented 1 year ago

I start my app with app = customtkinter.CTk app.set_appearance_mode("dark") and app.after(0, lambda: app.wm_state('zoomed')). Than I enable fullscreen with app.attributes("-fullscreen", true). After disabling fullscreen with app.attributes("-fullscreen", false), the mode for the window title bar has changed from "dark" to "light". I tried to set it back to dark mode with app.set_appearance_mode("dark") but it stays in light mode. Is this a bug? Is there a workaround I could try?

OddUnicorn commented 1 year ago

I already call self.set_appearance_mode("dark") after toggling fullscreen mode. My approach just looks a little different:

        self.bind('<f>', self.toggle_fullscreen)
[...]
    def toggle_fullscreen(self, event=None):
        # Toggle between fullscreen and windowed modes
        self.attributes("-fullscreen", not self.attributes("-fullscreen"))
        self.after(50, lambda: self.draw_image)
        self.after(50, lambda: ctk.set_appearance_mode("dark"))

Anyway, it doesn't help, the title bar won't switch back to dark mode. Just for clarification, CTk sometimes needs some time to end it's tasks, therefore the delayed scheduling, just to be on the safe side.

joocam commented 1 year ago

well, I'm still looking for a solution...

TomSchimansky commented 1 year ago

As a quick fix you can update to the correct titlebar color with this:

self._windows_set_titlebar_color(self._get_appearance_mode())

where self is an instance of CTk.