mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import tkinter
|
|
import customtkinter # <- import the CustomTkinter module
|
|
|
|
customtkinter.enable_macos_darkmode()
|
|
customtkinter.set_appearance_mode("System") # Other: "Dark", "Light"
|
|
|
|
root_tk = tkinter.Tk() # create the Tk window like you normally do
|
|
root_tk.geometry("400x240")
|
|
root_tk.title("CustomTkinter Test")
|
|
|
|
|
|
def change_button_2_state():
|
|
if button_2.state == tkinter.NORMAL:
|
|
button_2.configure(state=tkinter.DISABLED)
|
|
elif button_2.state == tkinter.DISABLED:
|
|
button_2.configure(state=tkinter.NORMAL)
|
|
|
|
|
|
def button_2_click():
|
|
print("button_2 clicked")
|
|
|
|
|
|
frame_1 = customtkinter.CTkFrame(master=root_tk, width=300, height=200, corner_radius=15)
|
|
frame_1.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
|
|
|
button_1 = customtkinter.CTkButton(master=frame_1, text="Disable/Enable Button_2",
|
|
corner_radius=10, command=change_button_2_state, width=200)
|
|
button_1.place(relx=0.5, rely=0.3, anchor=tkinter.CENTER)
|
|
|
|
button_2 = customtkinter.CTkButton(master=frame_1, text="Button_2",
|
|
corner_radius=10, command=button_2_click)
|
|
button_2.place(relx=0.5, rely=0.7, anchor=tkinter.CENTER)
|
|
|
|
root_tk.mainloop()
|
|
customtkinter.disable_macos_darkmode()
|