2022-09-15 14:28:02 +03:00
|
|
|
import customtkinter
|
|
|
|
import sys
|
|
|
|
|
|
|
|
customtkinter.set_appearance_mode("dark")
|
|
|
|
|
|
|
|
|
|
|
|
app = customtkinter.CTk()
|
2022-09-15 14:48:32 +03:00
|
|
|
app.geometry("400x400+300+300")
|
|
|
|
|
|
|
|
toplevel = customtkinter.CTkToplevel(app)
|
|
|
|
toplevel.geometry("350x240+800+300")
|
2022-09-15 14:28:02 +03:00
|
|
|
|
|
|
|
|
|
|
|
def change_appearance_mode():
|
|
|
|
# test appearance mode change while withdrawn
|
2022-09-15 14:48:32 +03:00
|
|
|
app.after(500, toplevel.withdraw)
|
2022-09-15 14:28:02 +03:00
|
|
|
app.after(1500, lambda: customtkinter.set_appearance_mode("light"))
|
2022-09-15 14:48:32 +03:00
|
|
|
app.after(2500, toplevel.deiconify)
|
2022-09-15 14:28:02 +03:00
|
|
|
|
|
|
|
# test appearance mode change while iconified
|
2022-09-15 14:48:32 +03:00
|
|
|
app.after(3500, toplevel.iconify)
|
2022-09-15 14:28:02 +03:00
|
|
|
app.after(4500, lambda: customtkinter.set_appearance_mode("dark"))
|
2022-09-15 14:48:32 +03:00
|
|
|
app.after(5500, toplevel.deiconify)
|
2022-09-15 14:28:02 +03:00
|
|
|
|
|
|
|
if sys.platform.startswith("win"):
|
|
|
|
# test appearance mode change while zoomed
|
2022-09-15 14:48:32 +03:00
|
|
|
app.after(6500, lambda: toplevel.state("zoomed"))
|
2022-09-15 14:28:02 +03:00
|
|
|
app.after(7500, lambda: customtkinter.set_appearance_mode("light"))
|
2022-09-15 14:48:32 +03:00
|
|
|
app.after(8500, lambda: toplevel.state("normal"))
|
2022-09-15 14:28:02 +03:00
|
|
|
|
|
|
|
|
|
|
|
button_1 = customtkinter.CTkButton(app, text="start test", command=change_appearance_mode)
|
|
|
|
button_1.pack(pady=20, padx=20)
|
|
|
|
|
|
|
|
app.mainloop()
|