2022-03-02 02:53:58 +03:00
|
|
|
import customtkinter
|
|
|
|
|
2022-03-08 01:00:50 +03:00
|
|
|
customtkinter.set_appearance_mode("dark")
|
|
|
|
customtkinter.set_default_color_theme("blue")
|
2022-11-29 15:04:51 +03:00
|
|
|
customtkinter.set_window_scaling(0.8)
|
|
|
|
customtkinter.set_widget_scaling(0.8)
|
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")
|
|
|
|
|
|
|
|
|
2022-11-11 15:06:26 +03:00
|
|
|
def button_1_click_event():
|
|
|
|
dialog = customtkinter.CTkInputDialog(text="Type in a number:", title="Test")
|
2022-03-02 02:53:58 +03:00
|
|
|
print("Number:", dialog.get_input())
|
|
|
|
|
|
|
|
|
2022-11-11 15:06:26 +03:00
|
|
|
def button_2_click_event():
|
|
|
|
dialog = customtkinter.CTkInputDialog(text="long text "*100, title="Test")
|
|
|
|
print("Number:", dialog.get_input())
|
|
|
|
|
|
|
|
|
|
|
|
button_1 = customtkinter.CTkButton(app, text="Open Dialog", command=button_1_click_event)
|
|
|
|
button_1.pack(pady=20)
|
|
|
|
button_2 = customtkinter.CTkButton(app, text="Open Dialog", command=button_2_click_event)
|
|
|
|
button_2.pack(pady=20)
|
2022-03-02 02:53:58 +03:00
|
|
|
c1 = customtkinter.CTkCheckBox(app, text="dark mode", command=change_mode)
|
2022-11-11 15:06:26 +03:00
|
|
|
c1.pack(pady=20)
|
2022-03-02 02:53:58 +03:00
|
|
|
|
2022-05-22 21:26:31 +03:00
|
|
|
app.mainloop()
|