added tests for CTk window behavior when switchng appearance mode and hiding at program start #66 #277

This commit is contained in:
TomSchimansky 2022-09-15 13:28:02 +02:00
parent 65c45abe32
commit 81f3f9a622
4 changed files with 53 additions and 25 deletions

View File

@ -0,0 +1,35 @@
import customtkinter
import sys
customtkinter.set_appearance_mode("dark")
app = customtkinter.CTk()
app.geometry("400x240")
app.withdraw()
app.after(2000, app.deiconify)
def change_appearance_mode():
# test appearance mode change while withdrawn
app.after(500, app.withdraw)
app.after(1500, lambda: customtkinter.set_appearance_mode("light"))
app.after(2500, app.deiconify)
# test appearance mode change while iconified
app.after(3500, app.iconify)
app.after(4500, lambda: customtkinter.set_appearance_mode("dark"))
app.after(5500, app.deiconify)
if sys.platform.startswith("win"):
# test appearance mode change while zoomed
app.after(6500, lambda: app.state("zoomed"))
app.after(7500, lambda: customtkinter.set_appearance_mode("light"))
app.after(8500, lambda: app.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,9 @@
import customtkinter
app = customtkinter.CTk()
app.geometry("400x240")
app.iconify()
app.after(2000, app.deiconify)
app.mainloop()

View File

@ -0,0 +1,9 @@
import customtkinter
app = customtkinter.CTk()
app.geometry("400x240")
app.withdraw()
app.after(2000, app.deiconify)
app.mainloop()

View File

@ -1,25 +0,0 @@
import customtkinter
app = customtkinter.CTk()
app.geometry("400x240")
app.iconify()
app.after(1000, app.deiconify)
def button_function():
top = customtkinter.CTkToplevel(app)
top.iconify()
app.after(1500, top.deiconify) # show toplevel
app.after(2000, top.iconify) # hide toplevel
app.after(2500, top.deiconify) # show toplevel
app.after(3500, app.iconify) # hide app
app.after(4000, app.deiconify) # show app
app.after(4500, top.lift) # show app
button = customtkinter.CTkButton(app, command=button_function)
button.pack(pady=20, padx=20)
app.mainloop()