That's how it looks.... but I can assure you that the thread are not running the mainloop. There are no tkinter calls made from any thread other than the main thread.
-----Original Message----- From: Tkinter-discuss <tkinter-discuss-bounces+mike_barnett=hotmail....@python.org> On Behalf Of Michael Lange Sent: Sunday, December 15, 2019 5:16 PM To: tkinter-discuss@python.org Subject: Re: [Tkinter-discuss] The Async delete problem.... Hi, On Sun, 15 Dec 2019 18:29:18 +0000 Mike Barnett <mike_barn...@hotmail.com> wrote: > I've been fighting this error for a couple of years now and just when > I think I've got it understood and "Fixed", it bites me again. > > > > Here's the error: > > > > Exception ignored in: <function Variable.__del__ at > 0x0000016CA840C9D0> > > Traceback (most recent call last): > > File "X:\Python\python3.8\lib\tkinter\__init__.py", line 351, in > __del__ > > if self._tk.getboolean(self._tk.call("info", "exists", self._name)): > > RuntimeError: main thread is not in main loop (...) > It happens in programs that are multi-threaded. The threads do NOT > make any tkinter calls and do not touch any variable that has anything > to do with tkinter. > > What appears to be happening is that tkinter objects are marked to be > deleted and then when Python's garbage collect runs and actually does > the deletes, it is happening in the context of the thread, not the > main thread. > > My way around this at the moment is to keep the widgets around for the > duration of the program rather than deleting them in any way. I would > really like to get this solved though as other people using my code > run into this and don't know what to do. > > Any ideas on how to dispose of widgets / windows in a way that > immediately calls these delete methods? Or is it possible to tell > tkinter that despite the deletes being called from another thread it's > OK because the thread isn't actually changing anything at the same > time as the main thread? > I am not sure what is happening here. It sounds a bit as if the tk gui is not in the main program thread? If yes, maybe this causes the problem; as far as I know it is imperative that the tk mainloop is inside the main program thread. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. We're all sorry for the other guy when he loses his job to a machine. But when it comes to your job -- that's different. And it always will be different. -- McCoy, "The Ultimate Computer", stardate 4729.4 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Ftkinter-discuss&data=02%7C01%7C%7C1b1a8693fa62493a417108d781ac6023%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637120449647261354&sdata=Rui1yhlJkmvxrA2xz9MtgdJG5zIJbHb8VjwQjqHKD6k%3D&reserved=0 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss