mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
CTkButton improved
This commit is contained in:
parent
365362fc0c
commit
e2b2db08df
@ -110,6 +110,7 @@ class App(tkinter.Tk):
|
|||||||
height=15,
|
height=15,
|
||||||
border_width=0)
|
border_width=0)
|
||||||
self.progressbar.place(relx=0.5, rely=0.85, anchor=tkinter.S)
|
self.progressbar.place(relx=0.5, rely=0.85, anchor=tkinter.S)
|
||||||
|
self.progressbar.set(0.65)
|
||||||
|
|
||||||
# ============ frame_right <- ============
|
# ============ frame_right <- ============
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ class App(tkinter.Tk):
|
|||||||
border_color=App.MAIN_COLOR,
|
border_color=App.MAIN_COLOR,
|
||||||
fg_color=None,
|
fg_color=None,
|
||||||
hover_color=App.MAIN_HOVER,
|
hover_color=App.MAIN_HOVER,
|
||||||
height=25,
|
height=28,
|
||||||
text="CTkButton",
|
text="CTkButton",
|
||||||
command=self.button_event,
|
command=self.button_event,
|
||||||
border_width=2,
|
border_width=2,
|
||||||
@ -153,7 +154,7 @@ class App(tkinter.Tk):
|
|||||||
|
|
||||||
self.entry = customtkinter.CTkEntry(master=self.frame_right,
|
self.entry = customtkinter.CTkEntry(master=self.frame_right,
|
||||||
width=120,
|
width=120,
|
||||||
height=25,
|
height=28,
|
||||||
corner_radius=0)
|
corner_radius=0)
|
||||||
self.entry.place(relx=0.33, rely=0.92, anchor=tkinter.CENTER)
|
self.entry.place(relx=0.33, rely=0.92, anchor=tkinter.CENTER)
|
||||||
self.entry.insert(0, "CTkEntry")
|
self.entry.insert(0, "CTkEntry")
|
||||||
@ -162,17 +163,13 @@ class App(tkinter.Tk):
|
|||||||
border_color=App.MAIN_COLOR,
|
border_color=App.MAIN_COLOR,
|
||||||
fg_color=None,
|
fg_color=None,
|
||||||
hover_color=App.MAIN_HOVER,
|
hover_color=App.MAIN_HOVER,
|
||||||
height=25,
|
height=28,
|
||||||
text="CTkButton",
|
text="CTkButton",
|
||||||
command=self.button_event,
|
command=self.button_event,
|
||||||
border_width=2,
|
border_width=2,
|
||||||
corner_radius=0)
|
corner_radius=0)
|
||||||
self.button_5.place(relx=0.66, rely=0.92, anchor=tkinter.CENTER)
|
self.button_5.place(relx=0.66, rely=0.92, anchor=tkinter.CENTER)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.progressbar.set(0.65)
|
|
||||||
|
|
||||||
def button_event(self):
|
def button_event(self):
|
||||||
print("Button pressed")
|
print("Button pressed")
|
||||||
|
|
||||||
|
@ -267,13 +267,13 @@ class CTkButton(tkinter.Frame):
|
|||||||
self.canvas.itemconfig(part, fill=self.hover_color, width=0)
|
self.canvas.itemconfig(part, fill=self.hover_color, width=0)
|
||||||
|
|
||||||
if self.text_label is not None:
|
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])
|
self.text_label.configure(bg=self.hover_color[self.appearance_mode])
|
||||||
else:
|
else:
|
||||||
self.text_label.configure(bg=self.hover_color)
|
self.text_label.configure(bg=self.hover_color)
|
||||||
|
|
||||||
if self.image_label is not None:
|
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])
|
self.image_label.configure(bg=self.hover_color[self.appearance_mode])
|
||||||
else:
|
else:
|
||||||
self.image_label.configure(bg=self.hover_color)
|
self.image_label.configure(bg=self.hover_color)
|
||||||
|
Loading…
Reference in New Issue
Block a user