2022-05-22 18:11:15 +03:00
|
|
|
import tkinter
|
|
|
|
import customtkinter
|
|
|
|
|
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
app = customtkinter.CTk()
|
|
|
|
app.geometry("400x800")
|
|
|
|
app.title("CustomTkinter Test")
|
2022-05-22 18:11:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
def change_state(widget):
|
|
|
|
if widget.state == tkinter.NORMAL:
|
|
|
|
widget.configure(state=tkinter.DISABLED)
|
|
|
|
elif widget.state == tkinter.DISABLED:
|
|
|
|
widget.configure(state=tkinter.NORMAL)
|
|
|
|
|
|
|
|
|
2022-05-22 20:45:42 +03:00
|
|
|
def widget_click():
|
|
|
|
print("widget clicked")
|
2022-05-22 18:11:15 +03:00
|
|
|
|
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
button_1 = customtkinter.CTkButton(master=app, text="button_1", command=widget_click)
|
2022-05-22 20:45:42 +03:00
|
|
|
button_1.pack(padx=20, pady=(20, 10))
|
2022-05-22 21:26:31 +03:00
|
|
|
button_2 = customtkinter.CTkButton(master=app, text="Disable/Enable button_1", command=lambda: change_state(button_1))
|
2022-05-22 20:45:42 +03:00
|
|
|
button_2.pack(padx=20, pady=(10, 20))
|
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
switch_1 = customtkinter.CTkSwitch(master=app, text="switch_1", command=widget_click)
|
2022-05-22 20:45:42 +03:00
|
|
|
switch_1.pack(padx=20, pady=(20, 10))
|
2022-05-22 21:26:31 +03:00
|
|
|
button_2 = customtkinter.CTkButton(master=app, text="Disable/Enable switch_1", command=lambda: change_state(switch_1))
|
2022-05-22 20:45:42 +03:00
|
|
|
button_2.pack(padx=20, pady=(10, 20))
|
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
entry_1 = customtkinter.CTkEntry(master=app, placeholder_text="entry_1")
|
2022-05-22 20:45:42 +03:00
|
|
|
entry_1.pack(padx=20, pady=(20, 10))
|
2022-05-22 21:26:31 +03:00
|
|
|
button_3 = customtkinter.CTkButton(master=app, text="Disable/Enable entry_1", command=lambda: change_state(entry_1))
|
2022-05-22 20:45:42 +03:00
|
|
|
button_3.pack(padx=20, pady=(10, 20))
|
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
checkbox_1 = customtkinter.CTkCheckBox(master=app, text="checkbox_1")
|
2022-05-22 20:45:42 +03:00
|
|
|
checkbox_1.pack(padx=20, pady=(20, 10))
|
2022-05-22 21:26:31 +03:00
|
|
|
button_4 = customtkinter.CTkButton(master=app, text="Disable/Enable checkbox_1", command=lambda: change_state(checkbox_1))
|
2022-05-22 20:45:42 +03:00
|
|
|
button_4.pack(padx=20, pady=(10, 20))
|
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
radiobutton_1 = customtkinter.CTkRadioButton(master=app, text="radiobutton_1")
|
2022-05-22 20:45:42 +03:00
|
|
|
radiobutton_1.pack(padx=20, pady=(20, 10))
|
2022-05-31 23:32:21 +03:00
|
|
|
button_5 = customtkinter.CTkButton(master=app, text="Disable/Enable radiobutton_1", command=lambda: change_state(radiobutton_1))
|
2022-05-22 20:45:42 +03:00
|
|
|
button_5.pack(padx=20, pady=(10, 20))
|
2022-05-22 18:11:15 +03:00
|
|
|
|
2022-05-31 23:32:21 +03:00
|
|
|
optionmenu_1 = customtkinter.CTkOptionMenu(app, values=["test 1", "test 2"])
|
|
|
|
optionmenu_1.pack(pady=10, padx=10)
|
|
|
|
button_6 = customtkinter.CTkButton(master=app, text="Disable/Enable optionmenu_1", command=lambda: change_state(optionmenu_1))
|
|
|
|
button_6.pack(padx=20, pady=(10, 20))
|
|
|
|
|
2022-06-02 00:50:50 +03:00
|
|
|
combobox_1 = customtkinter.CTkComboBox(app, values=["test 1", "test 2"])
|
|
|
|
combobox_1.pack(pady=10, padx=10)
|
|
|
|
button_7 = customtkinter.CTkButton(master=app, text="Disable/Enable combobox_1", command=lambda: change_state(combobox_1))
|
|
|
|
button_7.pack(padx=20, pady=(10, 20))
|
|
|
|
|
2022-05-22 18:11:15 +03:00
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
app.mainloop()
|