CTkButton improved

This commit is contained in:
Tom Schimansky 2021-03-12 12:15:38 +01:00
parent 365362fc0c
commit e2b2db08df
2 changed files with 6 additions and 9 deletions

View File

@ -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")

View File

@ -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)