mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added update_idletasks call to base class set_appearance_mode
This commit is contained in:
parent
50a8bb140e
commit
0d8a79d783
@ -220,6 +220,7 @@ class CTkBaseClass(tkinter.Frame, CTkAppearanceModeBaseClass, CTkScalingBaseClas
|
|||||||
def _set_appearance_mode(self, mode_string):
|
def _set_appearance_mode(self, mode_string):
|
||||||
super()._set_appearance_mode(mode_string)
|
super()._set_appearance_mode(mode_string)
|
||||||
self._draw()
|
self._draw()
|
||||||
|
super().update_idletasks()
|
||||||
|
|
||||||
def _set_scaling(self, new_widget_scaling, new_window_scaling):
|
def _set_scaling(self, new_widget_scaling, new_window_scaling):
|
||||||
super()._set_scaling(new_widget_scaling, new_window_scaling)
|
super()._set_scaling(new_widget_scaling, new_window_scaling)
|
||||||
|
@ -94,6 +94,8 @@ class CTkFrame(CTkBaseClass):
|
|||||||
def _draw(self, no_color_updates=False):
|
def _draw(self, no_color_updates=False):
|
||||||
super()._draw(no_color_updates)
|
super()._draw(no_color_updates)
|
||||||
|
|
||||||
|
print("frame draw", no_color_updates)
|
||||||
|
|
||||||
if not self._canvas.winfo_exists():
|
if not self._canvas.winfo_exists():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@ class App(customtkinter.CTk):
|
|||||||
self.grid_columnconfigure(1, weight=1)
|
self.grid_columnconfigure(1, weight=1)
|
||||||
|
|
||||||
# load images with light and dark mode image
|
# load images with light and dark mode image
|
||||||
current_path = os.path.dirname(os.path.realpath(__file__))
|
image_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_images")
|
||||||
self.home_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(current_path, "test_images", "home_dark.png")),
|
self.home_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(image_path, "home_dark.png")),
|
||||||
dark_image=Image.open(os.path.join(current_path, "test_images", "home_light.png")), size=(20, 20))
|
dark_image=Image.open(os.path.join(image_path, "home_light.png")), size=(20, 20))
|
||||||
self.chat_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(current_path, "test_images", "chat_dark.png")),
|
self.chat_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(image_path, "chat_dark.png")),
|
||||||
dark_image=Image.open(os.path.join(current_path, "test_images", "chat_light.png")), size=(20, 20))
|
dark_image=Image.open(os.path.join(image_path, "chat_light.png")), size=(20, 20))
|
||||||
self.add_user_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(current_path, "test_images", "add_user_dark.png")),
|
self.add_user_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(image_path, "add_user_dark.png")),
|
||||||
dark_image=Image.open(os.path.join(current_path, "test_images", "add_user_light.png")), size=(20, 20))
|
dark_image=Image.open(os.path.join(image_path, "add_user_light.png")), size=(20, 20))
|
||||||
|
|
||||||
# create navigation frame
|
# create navigation frame
|
||||||
self.navigation_frame = customtkinter.CTkFrame(self, corner_radius=0)
|
self.navigation_frame = customtkinter.CTkFrame(self, corner_radius=0)
|
||||||
@ -51,15 +51,15 @@ class App(customtkinter.CTk):
|
|||||||
|
|
||||||
# create home frame
|
# create home frame
|
||||||
self.home_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
self.home_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
||||||
self.home_frame.grid(row=0, column=1, sticky="nsew")
|
|
||||||
|
|
||||||
# create chat frame
|
# create chat frame
|
||||||
self.chat_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
self.chat_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
||||||
self.chat_frame.grid(row=0, column=1, sticky="nsew")
|
|
||||||
|
|
||||||
# create add user frame
|
# create add user frame
|
||||||
self.add_user_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
self.add_user_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
||||||
self.add_user_frame.grid(row=0, column=1, sticky="nsew")
|
|
||||||
|
# select default frame
|
||||||
|
self.select_frame_by_name("home")
|
||||||
|
|
||||||
def select_frame_by_name(self, name):
|
def select_frame_by_name(self, name):
|
||||||
# set button color for selected button
|
# set button color for selected button
|
||||||
@ -80,8 +80,6 @@ class App(customtkinter.CTk):
|
|||||||
self.home_frame.grid(row=0, column=1, sticky="nsew")
|
self.home_frame.grid(row=0, column=1, sticky="nsew")
|
||||||
else:
|
else:
|
||||||
self.home_frame.grid_forget()
|
self.home_frame.grid_forget()
|
||||||
self.chat_button.configure(fg_color="transparent")
|
|
||||||
self.add_user_button.configure(fg_color="transparent")
|
|
||||||
|
|
||||||
def home_button_event(self):
|
def home_button_event(self):
|
||||||
self.select_frame_by_name("home")
|
self.select_frame_by_name("home")
|
||||||
|
Loading…
Reference in New Issue
Block a user