2022-03-02 02:53:58 +03:00
|
|
|
import customtkinter
|
|
|
|
import tkinter
|
|
|
|
|
2022-03-08 01:00:50 +03:00
|
|
|
customtkinter.set_appearance_mode("dark")
|
|
|
|
customtkinter.set_default_color_theme("blue")
|
2022-03-02 02:53:58 +03:00
|
|
|
|
|
|
|
app = customtkinter.CTk()
|
|
|
|
app.geometry("400x300")
|
|
|
|
app.title("CTkDialog Test")
|
|
|
|
|
|
|
|
|
|
|
|
def change_mode():
|
2022-04-20 23:50:57 +03:00
|
|
|
if c1.get() == 0:
|
2022-03-02 02:53:58 +03:00
|
|
|
customtkinter.set_appearance_mode("light")
|
2022-04-20 23:50:57 +03:00
|
|
|
else:
|
2022-03-02 02:53:58 +03:00
|
|
|
customtkinter.set_appearance_mode("dark")
|
|
|
|
|
|
|
|
|
|
|
|
def button_click_event():
|
2022-03-08 01:00:50 +03:00
|
|
|
dialog = customtkinter.CTkInputDialog(master=None, text="Type in a number:", title="Test")
|
2022-03-02 02:53:58 +03:00
|
|
|
print("Number:", dialog.get_input())
|
|
|
|
|
|
|
|
|
|
|
|
button = customtkinter.CTkButton(app, text="Open Dialog", command=button_click_event)
|
|
|
|
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
|
|
|
|
c1 = customtkinter.CTkCheckBox(app, text="dark mode", command=change_mode)
|
|
|
|
c1.place(relx=0.5, rely=0.8, anchor=tkinter.CENTER)
|
|
|
|
|
|
|
|
app.mainloop()
|