TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.33k stars 1.07k forks source link

Invalid command name #2274

Open kohinoor12 opened 7 months ago

kohinoor12 commented 7 months ago

invalid command name "1806550247616update" while executing "1806550247616update" ("after" script) invalid command name "1806550247232check_dpi_scaling" while executing "1806550247232check_dpi_scaling" ("after" script)

self.win = customtkinter.CTk()

When generating a new window immediately after closing the previous one, the above message is generated on the console but the code works fine without any error can you please solve this as some people consider it as an error

AshhadDevLab commented 7 months ago

Description:

This is caused because the window is instantiated to be looped after the initial window has been destroyed. Something like this:

window.destroy()
anotherwindow.mainloop()

Solution:

To avoid this you can make use of CTkTopLevel or create multiple CTkFrame widgets instead of windows and move back and fourth in them.

AshhadDevLab commented 7 months ago

If this answers your question mark it as solved!

kohinoor12 commented 7 months ago

Exception ignored in: <function Variable.del at 0x0000017B96258A60> Traceback (most recent call last): File "AppData\Local\Programs\Python\Python39\lib\tkinter__init.py", line 363, in del__ if self._tk.getboolean(self._tk.call("info", "exists", self._name)): RuntimeError: main thread is not in main loop

I am getting this message in the console but the application still works fine but if the message comes more then 8-10 times then the application crashes

AshhadDevLab commented 7 months ago

Did you try my solution?

kohinoor12 commented 7 months ago

Yes that issue is resolved now, in my application I have a popup window that works as a preloader when different functions been called that time I'm getting the above message

AshhadDevLab commented 7 months ago

instead of destroying the window withdraw it first and after the other window is loaded destroy it

AshhadDevLab commented 7 months ago

can you somehow give a minimal reproducible code