From e0eebac62ce6de3ce5e3602044e01196fdbb570d Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Sun, 1 May 2022 23:38:02 +0200 Subject: [PATCH] fixed scaling --- customtkinter/widgets/widget_base_class.py | 2 ++ test/test_all_widgets_with_colors.py | 2 +- test/test_askdialog.py | 7 +------ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/customtkinter/widgets/widget_base_class.py b/customtkinter/widgets/widget_base_class.py index 2f0bd0a..f57c148 100644 --- a/customtkinter/widgets/widget_base_class.py +++ b/customtkinter/widgets/widget_base_class.py @@ -27,6 +27,8 @@ class CTkBaseClass(tkinter.Frame): self.widget_scaling = ScalingTracker.get_widget_scaling(self) self.spacing_scaling = ScalingTracker.get_spacing_scaling(self) + super().configure(width=self.apply_widget_scaling(self.desired_width), height=self.apply_widget_scaling(self.desired_height)) + # save latest geometry function and kwargs class GeometryCallDict(TypedDict): function: Callable diff --git a/test/test_all_widgets_with_colors.py b/test/test_all_widgets_with_colors.py index f411cb8..1bc58b6 100644 --- a/test/test_all_widgets_with_colors.py +++ b/test/test_all_widgets_with_colors.py @@ -1,5 +1,5 @@ import tkinter -import customtkinter # <- import the CustomTkinter module +import customtkinter customtkinter.set_appearance_mode("System") # Other: "Dark", "Light" customtkinter.set_default_color_theme("green") # Themes: "blue" (standard), "green", "dark-blue" diff --git a/test/test_askdialog.py b/test/test_askdialog.py index a4c54c1..aa4cb2d 100644 --- a/test/test_askdialog.py +++ b/test/test_askdialog.py @@ -17,7 +17,6 @@ class App(customtkinter.CTk): MAIN_COLOR_DARK = "#2D5862" MAIN_HOVER = "#05f4b7" - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -28,14 +27,13 @@ class App(customtkinter.CTk): self.protocol("WM_DELETE_WINDOW", self.on_closing) # ============ create two CTkFrames ============ - #1 self.frame_left = customtkinter.CTkFrame(master=self, width=220, height=App.HEIGHT-40, corner_radius=5) self.frame_left.place(relx=0.38, rely=0.5, anchor=tkinter.E) + print(self.frame_left.widget_scaling) - #2 self.frame_right = customtkinter.CTkFrame(master=self, width=350, height=App.HEIGHT-40, @@ -52,7 +50,6 @@ class App(customtkinter.CTk): self.entry_output = customtkinter.CTkEntry(master=self.frame_right, width=320, height=38, corner_radius=5) self.entry_output.place(relx=0.05, rely=0.18, anchor=tkinter.NW) - def button_outputFunc(self): self.entry_output.delete(0, 'end') filename = fd.askdirectory() @@ -66,8 +63,6 @@ class App(customtkinter.CTk): self.mainloop() - - if __name__ == "__main__": app = App() app.start() \ No newline at end of file