I have a window in customtkinter
, version 5.20
, with a button to destroy it:
import customtkinter as ctk
# window 1
window1 = ctk.CTk()
window1.geometry('400x300')
ctk.CTkButton(window1, text = 'Destroy', command = window1.destroy).pack(expand = True)
window1.mainloop()
The code works fine as it should be, but if after destroy the window I want to create a second one:
# window 2
window2 = ctk.CTk()
window2.geometry('400x300')
window2.mainloop()
Then the code give me this error:
invalid command name "2036367448128update"
while executing
"2036367448128update"
("after" script)
invalid command name "2036367449792check_dpi_scaling"
while executing
"2036367449792check_dpi_scaling"
("after" script)
invalid command name "2036367445824_click_animation"
while executing
"2036367445824_click_animation"
("after" script)
The code works and the second window is created, but I don't get what this error means.
I tried to write this in Tkinter
and it doesn't give me any error:
import tkinter as tk
# window 1
window1 = tk.Tk()
window1.geometry('400x300')
tk.Button(window1, text = 'Destroy', command = window1.destroy).pack(expand = True)
window1.mainloop()
# window 2
window2 = tk.Tk()
window2.geometry('400x300')
window2.mainloop()
I also tried to use quit()
instead of destroy()
, but the first window is not closed and just create the second one.