added zoom and appearance mode behavior tests for CTkToplevel #66

This commit is contained in:
TomSchimansky 2022-09-15 13:48:32 +02:00
parent dcde8d69d8
commit d2f8fd012f
8 changed files with 88 additions and 0 deletions

View File

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

View File

@ -0,0 +1,12 @@
import customtkinter
app = customtkinter.CTk()
app.geometry("400x400+300+300")
toplevel = customtkinter.CTkToplevel(app)
toplevel.geometry("350x240+800+300")
toplevel.iconify()
toplevel.after(2000, toplevel.deiconify)
app.mainloop()

View File

@ -0,0 +1,12 @@
import customtkinter
app = customtkinter.CTk()
app.geometry("400x400+300+300")
toplevel = customtkinter.CTkToplevel(app)
toplevel.geometry("350x240+800+300")
toplevel.withdraw()
toplevel.after(2000, toplevel.deiconify)
app.mainloop()

View File

@ -0,0 +1,29 @@
import customtkinter
customtkinter.set_appearance_mode("dark")
app = customtkinter.CTk()
app.geometry("400x400+300+300")
toplevel = customtkinter.CTkToplevel(app)
toplevel.geometry("350x240+800+300")
def change_appearance_mode():
# test zoom with withdraw
app.after(1000, lambda: toplevel.state("zoomed"))
app.after(2000, toplevel.withdraw)
app.after(3000, toplevel.deiconify)
app.after(4000, lambda: toplevel.state("normal"))
# test zoom with iconify
app.after(5000, lambda: toplevel.state("zoomed"))
app.after(6000, toplevel.iconify)
app.after(7000, toplevel.deiconify)
app.after(8000, lambda: toplevel.state("normal"))
button_1 = customtkinter.CTkButton(app, text="start test", command=change_appearance_mode)
button_1.pack(pady=20, padx=20)
app.mainloop()