From cdaf8f5f5cd91401300574e63494e527edef6a58 Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Sat, 2 Jul 2022 14:10:41 +0200 Subject: [PATCH] changed default CTkLabel corner_radius for better positioning --- customtkinter/assets/themes/blue.json | 2 +- customtkinter/assets/themes/dark-blue.json | 2 +- customtkinter/assets/themes/green.json | 2 +- customtkinter/assets/themes/sweetkind.json | 2 +- .../complex_example_new.py | 19 +++++++++++++++---- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/customtkinter/assets/themes/blue.json b/customtkinter/assets/themes/blue.json index 06b580f..b42f3d1 100644 --- a/customtkinter/assets/themes/blue.json +++ b/customtkinter/assets/themes/blue.json @@ -62,7 +62,7 @@ "entry_border_width": 2, "frame_corner_radius": 6, "frame_border_width": 0, - "label_corner_radius": 8, + "label_corner_radius": 0, "progressbar_border_width": 0, "progressbar_corner_radius": 1000, "slider_border_width": 6, diff --git a/customtkinter/assets/themes/dark-blue.json b/customtkinter/assets/themes/dark-blue.json index f2f2c9f..2868ec4 100644 --- a/customtkinter/assets/themes/dark-blue.json +++ b/customtkinter/assets/themes/dark-blue.json @@ -62,7 +62,7 @@ "entry_border_width": 2, "frame_corner_radius": 10, "frame_border_width": 0, - "label_corner_radius": 8, + "label_corner_radius": 0, "progressbar_border_width": 0, "progressbar_corner_radius": 1000, "slider_border_width": 6, diff --git a/customtkinter/assets/themes/green.json b/customtkinter/assets/themes/green.json index 469f9fe..a6608a1 100644 --- a/customtkinter/assets/themes/green.json +++ b/customtkinter/assets/themes/green.json @@ -62,7 +62,7 @@ "entry_border_width": 2, "frame_corner_radius": 10, "frame_border_width": 0, - "label_corner_radius": 8, + "label_corner_radius": 0, "progressbar_border_width": 0, "progressbar_corner_radius": 1000, "slider_border_width": 6, diff --git a/customtkinter/assets/themes/sweetkind.json b/customtkinter/assets/themes/sweetkind.json index 0c952b6..f9bec05 100644 --- a/customtkinter/assets/themes/sweetkind.json +++ b/customtkinter/assets/themes/sweetkind.json @@ -62,7 +62,7 @@ "entry_border_width": 2, "frame_corner_radius": 10, "frame_border_width": 2, - "label_corner_radius": 8, + "label_corner_radius": 0, "progressbar_border_width": 2, "progressbar_corner_radius": 1000, "slider_border_width": 6, diff --git a/test/manual_integration_tests/complex_example_new.py b/test/manual_integration_tests/complex_example_new.py index 08167ea..adff63c 100644 --- a/test/manual_integration_tests/complex_example_new.py +++ b/test/manual_integration_tests/complex_example_new.py @@ -20,7 +20,7 @@ class App(customtkinter.CTk): self.grid_columnconfigure((2, 3), weight=0, minsize=200) self.grid_rowconfigure((0, 1, 2), weight=1) - # create sidebar frame and widgets + # create sidebar frame with widgets self.sidebar_frame = customtkinter.CTkFrame(self, width=140) self.sidebar_frame.grid(row=0, column=0, rowspan=4, sticky="nsew") self.sidebar_frame.grid_rowconfigure(4, weight=1) @@ -32,11 +32,16 @@ class App(customtkinter.CTk): self.sidebar_button_2.grid(row=2, column=0, padx=20, pady=10) self.sidebar_button_3 = customtkinter.CTkButton(self.sidebar_frame, command=self.sidebar_button_callback) self.sidebar_button_3.grid(row=3, column=0, padx=20, pady=10) - self.appearance_mode_label = customtkinter.CTkLabel(self.sidebar_frame, text="Appearance Mode:") + self.appearance_mode_label = customtkinter.CTkLabel(self.sidebar_frame, text="Appearance Mode:", anchor="w") self.appearance_mode_label.grid(row=5, column=0, padx=20, pady=(10, 0)) self.appearance_mode_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["Light", "Dark", "System"], command=self.change_appearance_mode) - self.appearance_mode_optionemenu.grid(row=6, column=0, padx=20, pady=(10, 20)) + self.appearance_mode_optionemenu.grid(row=6, column=0, padx=20, pady=(10, 10)) + self.scaling_label = customtkinter.CTkLabel(self.sidebar_frame, text="Widget Scaling:", anchor="w") + self.scaling_label.grid(row=7, column=0, padx=20, pady=(10, 0)) + self.scaling_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["75%", "100%", "150%"], + command=self.change_scaling) + self.scaling_optionemenu.grid(row=8, column=0, padx=20, pady=(10, 20)) # create main entry and button self.entry = customtkinter.CTkEntry(self, placeholder_text="CTkEntry") @@ -111,6 +116,7 @@ class App(customtkinter.CTk): self.switch_1.select() self.radio_button_3.configure(state="disabled") self.appearance_mode_optionemenu.set("Dark") + self.scaling_optionemenu.set("100%") self.optionmenu_1.set("CTkOptionmenu") self.combobox_1.set("CTkComboBox") @@ -118,9 +124,14 @@ class App(customtkinter.CTk): dialog = customtkinter.CTkInputDialog(master=None, text="Type in a number:", title="CTkInputDialog") print("CTkInputDialog:", dialog.get_input()) - def change_appearance_mode(self, new_appearance_mode): + def change_appearance_mode(self, new_appearance_mode: str): customtkinter.set_appearance_mode(new_appearance_mode) + def change_scaling(self, new_scaling: str): + new_scaling_float = int(new_scaling.replace("%", "")) / 100 + customtkinter.set_spacing_scaling(new_scaling_float) + customtkinter.set_widget_scaling(new_scaling_float) + def sidebar_button_callback(self): print("sidebar_button click")