From 330ef9d438bf14cbb5f28485df5679737057e4aa Mon Sep 17 00:00:00 2001 From: BRUNO1993-CIBER Date: Sat, 6 Jun 2026 09:58:58 -0300 Subject: [PATCH] fix: save window state before withdraw in _windows_set_titlebar_color when window not yet shown When withdraw() is called before mainloop(), _state_before_windows_set_titlebar_color was never set in the else branch, remaining None. The restore block then called self.state(None) which is a no-op query, leaving the window permanently hidden. Fixes #2810 --- customtkinter/windows/ctk_tk.py | 1 + 1 file changed, 1 insertion(+) diff --git a/customtkinter/windows/ctk_tk.py b/customtkinter/windows/ctk_tk.py index e137dc3c..a2dc2665 100644 --- a/customtkinter/windows/ctk_tk.py +++ b/customtkinter/windows/ctk_tk.py @@ -278,6 +278,7 @@ def _windows_set_titlebar_color(self, color_mode: str): super().withdraw() # hide window so that it can be redrawn after the titlebar change so that the color change is visible else: # print("window dont exists -> withdraw and update") + self._state_before_windows_set_titlebar_color = self.state() self.focused_widget_before_widthdraw = self.focus_get() super().withdraw() super().update()