From e2b2db08df340c240652334d012a022fb5e29d14 Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Fri, 12 Mar 2021 12:15:38 +0100 Subject: [PATCH] CTkButton improved --- complex_example_other_style.py | 11 ++++------- customtkinter/customtkinter_button.py | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/complex_example_other_style.py b/complex_example_other_style.py index 79c282e..54301c8 100644 --- a/complex_example_other_style.py +++ b/complex_example_other_style.py @@ -110,6 +110,7 @@ class App(tkinter.Tk): height=15, border_width=0) self.progressbar.place(relx=0.5, rely=0.85, anchor=tkinter.S) + self.progressbar.set(0.65) # ============ frame_right <- ============ @@ -144,7 +145,7 @@ class App(tkinter.Tk): border_color=App.MAIN_COLOR, fg_color=None, hover_color=App.MAIN_HOVER, - height=25, + height=28, text="CTkButton", command=self.button_event, border_width=2, @@ -153,7 +154,7 @@ class App(tkinter.Tk): self.entry = customtkinter.CTkEntry(master=self.frame_right, width=120, - height=25, + height=28, corner_radius=0) self.entry.place(relx=0.33, rely=0.92, anchor=tkinter.CENTER) self.entry.insert(0, "CTkEntry") @@ -162,17 +163,13 @@ class App(tkinter.Tk): border_color=App.MAIN_COLOR, fg_color=None, hover_color=App.MAIN_HOVER, - height=25, + height=28, text="CTkButton", command=self.button_event, border_width=2, corner_radius=0) self.button_5.place(relx=0.66, rely=0.92, anchor=tkinter.CENTER) - - - self.progressbar.set(0.65) - def button_event(self): print("Button pressed") diff --git a/customtkinter/customtkinter_button.py b/customtkinter/customtkinter_button.py index 28cb7df..22f17a5 100644 --- a/customtkinter/customtkinter_button.py +++ b/customtkinter/customtkinter_button.py @@ -267,13 +267,13 @@ class CTkButton(tkinter.Frame): self.canvas.itemconfig(part, fill=self.hover_color, width=0) if self.text_label is not None: - if type(self.fg_color) == tuple and len(self.fg_color) == 2: + if type(self.hover_color) == tuple and len(self.hover_color) == 2: self.text_label.configure(bg=self.hover_color[self.appearance_mode]) else: self.text_label.configure(bg=self.hover_color) if self.image_label is not None: - if type(self.fg_color) == tuple and len(self.fg_color) == 2: + if type(self.hover_color) == tuple and len(self.hover_color) == 2: self.image_label.configure(bg=self.hover_color[self.appearance_mode]) else: self.image_label.configure(bg=self.hover_color)