changed default CTkLabel corner_radius for better positioning

This commit is contained in:
Tom Schimansky 2022-07-02 14:10:41 +02:00
parent 7e8bbf2968
commit cdaf8f5f5c
5 changed files with 19 additions and 8 deletions

View File

@ -62,7 +62,7 @@
"entry_border_width": 2, "entry_border_width": 2,
"frame_corner_radius": 6, "frame_corner_radius": 6,
"frame_border_width": 0, "frame_border_width": 0,
"label_corner_radius": 8, "label_corner_radius": 0,
"progressbar_border_width": 0, "progressbar_border_width": 0,
"progressbar_corner_radius": 1000, "progressbar_corner_radius": 1000,
"slider_border_width": 6, "slider_border_width": 6,

View File

@ -62,7 +62,7 @@
"entry_border_width": 2, "entry_border_width": 2,
"frame_corner_radius": 10, "frame_corner_radius": 10,
"frame_border_width": 0, "frame_border_width": 0,
"label_corner_radius": 8, "label_corner_radius": 0,
"progressbar_border_width": 0, "progressbar_border_width": 0,
"progressbar_corner_radius": 1000, "progressbar_corner_radius": 1000,
"slider_border_width": 6, "slider_border_width": 6,

View File

@ -62,7 +62,7 @@
"entry_border_width": 2, "entry_border_width": 2,
"frame_corner_radius": 10, "frame_corner_radius": 10,
"frame_border_width": 0, "frame_border_width": 0,
"label_corner_radius": 8, "label_corner_radius": 0,
"progressbar_border_width": 0, "progressbar_border_width": 0,
"progressbar_corner_radius": 1000, "progressbar_corner_radius": 1000,
"slider_border_width": 6, "slider_border_width": 6,

View File

@ -62,7 +62,7 @@
"entry_border_width": 2, "entry_border_width": 2,
"frame_corner_radius": 10, "frame_corner_radius": 10,
"frame_border_width": 2, "frame_border_width": 2,
"label_corner_radius": 8, "label_corner_radius": 0,
"progressbar_border_width": 2, "progressbar_border_width": 2,
"progressbar_corner_radius": 1000, "progressbar_corner_radius": 1000,
"slider_border_width": 6, "slider_border_width": 6,

View File

@ -20,7 +20,7 @@ class App(customtkinter.CTk):
self.grid_columnconfigure((2, 3), weight=0, minsize=200) self.grid_columnconfigure((2, 3), weight=0, minsize=200)
self.grid_rowconfigure((0, 1, 2), weight=1) 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 = customtkinter.CTkFrame(self, width=140)
self.sidebar_frame.grid(row=0, column=0, rowspan=4, sticky="nsew") self.sidebar_frame.grid(row=0, column=0, rowspan=4, sticky="nsew")
self.sidebar_frame.grid_rowconfigure(4, weight=1) 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_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 = customtkinter.CTkButton(self.sidebar_frame, command=self.sidebar_button_callback)
self.sidebar_button_3.grid(row=3, column=0, padx=20, pady=10) 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_label.grid(row=5, column=0, padx=20, pady=(10, 0))
self.appearance_mode_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["Light", "Dark", "System"], self.appearance_mode_optionemenu = customtkinter.CTkOptionMenu(self.sidebar_frame, values=["Light", "Dark", "System"],
command=self.change_appearance_mode) 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 # create main entry and button
self.entry = customtkinter.CTkEntry(self, placeholder_text="CTkEntry") self.entry = customtkinter.CTkEntry(self, placeholder_text="CTkEntry")
@ -111,6 +116,7 @@ class App(customtkinter.CTk):
self.switch_1.select() self.switch_1.select()
self.radio_button_3.configure(state="disabled") self.radio_button_3.configure(state="disabled")
self.appearance_mode_optionemenu.set("Dark") self.appearance_mode_optionemenu.set("Dark")
self.scaling_optionemenu.set("100%")
self.optionmenu_1.set("CTkOptionmenu") self.optionmenu_1.set("CTkOptionmenu")
self.combobox_1.set("CTkComboBox") 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") dialog = customtkinter.CTkInputDialog(master=None, text="Type in a number:", title="CTkInputDialog")
print("CTkInputDialog:", dialog.get_input()) 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) 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): def sidebar_button_callback(self):
print("sidebar_button click") print("sidebar_button click")