You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using matploy throught pyplot when I quit my application I've the message :
Exception ignored in: <function Image.__del__ at 0x7fb34d3e4268>
Traceback (most recent call last):
File "/usr/lib/python3.7/tkinter/__init__.py", line 3504, in __del__
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong thread
Abandon
I do the stuff into a separate thread because I want my primary thread to be responsive, no gui etc... I have only the default created figure and I've tryed to call plt.close() close('all') before the thread terminate.
It seems there is a static method in _backend_tk.py wich manage the mainloop, I've not followed all the code, but it seems it try to cleanup the rest at program exit.
Is there a way to make Tk and Tcl fully destroyed into my GUI thread ?
import time
import threading
import matplotlib.pyplot as plt
class MyThread(threading.Thread):
def __init__(self):
super().__init__()
def run(self):
plt.ion()
while self._running:
fig = plt.gcf()
fig.clear()
plt.show(block=False)
plt.pause(0.1)
plt.ioff()
plt.close('all')
my_thread = MyThread()
my_thread.setDaemon(True)
my_thread._running = True
my_thread.start()
time.sleep(2)
my_thread._running = False
my_thread.join()
The text was updated successfully, but these errors were encountered:
GUIs typically demand that they be run on the main thread (this comes from the GUI frameworks). I suggest that you let the GUI run on the main thread and push your other computation to a background thread.
Using matploy throught pyplot when I quit my application I've the message :
I do the stuff into a separate thread because I want my primary thread to be responsive, no gui etc... I have only the default created figure and I've tryed to call plt.close() close('all') before the thread terminate.
It seems there is a static method in _backend_tk.py wich manage the mainloop, I've not followed all the code, but it seems it try to cleanup the rest at program exit.
Is there a way to make Tk and Tcl fully destroyed into my GUI thread ?
The text was updated successfully, but these errors were encountered: