Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tcl_AsyncDelete: async handler deleted by the wrong thread #12085

Closed
Labels
Milestone
@firebird631

Description

@firebird631

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 loopTcl_AsyncDelete: async handler deleted by the wrong threadAbandon

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 timeimport threadingimport matplotlib.pyplot as pltclass 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 = Truemy_thread.start()time.sleep(2)my_thread._running = Falsemy_thread.join()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp