24 lines
485 B
Python
24 lines
485 B
Python
import customtkinter as ctk
|
|
|
|
app = ctk.CTk()
|
|
app.geometry("400x300")
|
|
|
|
def on_click():
|
|
print("Button clicked via command!")
|
|
|
|
def on_bind(e):
|
|
print("Button clicked via bind!")
|
|
|
|
b1 = ctk.CTkButton(app, text="Normal Command", command=on_click)
|
|
b1.pack(pady=20)
|
|
|
|
b2 = ctk.CTkButton(app, text="Bind Button-1")
|
|
b2.bind("<Button-1>", on_bind)
|
|
b2.pack(pady=20)
|
|
|
|
b3 = ctk.CTkButton(app, text="Bind ButtonRelease-1")
|
|
b3.bind("<ButtonRelease-1>", on_bind)
|
|
b3.pack(pady=20)
|
|
|
|
app.mainloop()
|