Title: Tcl_AsyncDelete: async handler deleted by the wrong thread · Issue #12085 · matplotlib/matplotlib · GitHub
Open Graph Title: Tcl_AsyncDelete: async handler deleted by the wrong thread · Issue #12085 · matplotlib/matplotlib
X Title: Tcl_AsyncDelete: async handler deleted by the wrong thread · Issue #12085 · matplotlib/matplotlib
Description: Using matploy throught pyplot when I quit my application I've the message : Exception ignored in:
Open Graph Description: Using matploy throught pyplot when I quit my application I've the message : Exception ignored in:
X Description: 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 "...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12085
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tcl_AsyncDelete: async handler deleted by the wrong thread","articleBody":"Using matploy throught pyplot when I quit my application I've the message :\r\n\r\n```\r\nException ignored in: \u003cfunction Image.__del__ at 0x7fb34d3e4268\u003e\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3.7/tkinter/__init__.py\", line 3504, in __del__\r\nRuntimeError: main thread is not in main loop\r\nTcl_AsyncDelete: async handler deleted by the wrong thread\r\nAbandon\r\n```\r\n\r\nI 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.\r\n\r\nIt 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.\r\n\r\nIs there a way to make Tk and Tcl fully destroyed into my GUI thread ?\r\n\r\n```\r\nimport time\r\nimport threading\r\nimport matplotlib.pyplot as plt\r\n\r\n\r\nclass MyThread(threading.Thread):\r\n\r\n\tdef __init__(self):\r\n\t\tsuper().__init__()\r\n\r\n\tdef run(self):\r\n\t\tplt.ion()\r\n\r\n\t\twhile self._running:\r\n\t\t\tfig = plt.gcf()\r\n\t\t\tfig.clear()\r\n\r\n\t\t\tplt.show(block=False)\r\n\t\t\tplt.pause(0.1)\r\n\r\n\t\tplt.ioff()\r\n\t\tplt.close('all')\r\n\r\nmy_thread = MyThread()\r\n\r\nmy_thread.setDaemon(True)\r\nmy_thread._running = True\r\nmy_thread.start()\r\n\r\ntime.sleep(2)\r\nmy_thread._running = False\r\n\r\nmy_thread.join()\r\n```\r\n","author":{"url":"https://github.com/firebird631","@type":"Person","name":"firebird631"},"datePublished":"2018-09-10T23:49:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/12085/matplotlib/issues/12085"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3998e6b2-6d76-d8a4-888f-5f9a768750ca |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E15C:1B675D:17E9D3E:206C99C:6A535F35 |
| html-safe-nonce | 857f450f1804da07fa8b15b951fa306beb8f6e4208b6d33c9ceae1e3f1f308ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTVDOjFCNjc1RDoxN0U5RDNFOjIwNkM5OUM6NkE1MzVGMzUiLCJ2aXNpdG9yX2lkIjoiNjE0MzA5MzAwOTQ0Nzg3MDI2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a3f5d1bd01a21883d8fa34547f4f3ab5e470b8d9024e98eb18d5658aaf64be25 |
| hovercard-subject-tag | issue:358835115 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/12085/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6fafcb4ef0aac7b5d157a3588f278de0c0b7173900214ab5e72dc1ea04b64ae/matplotlib/matplotlib/issues/12085 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6fafcb4ef0aac7b5d157a3588f278de0c0b7173900214ab5e72dc1ea04b64ae/matplotlib/matplotlib/issues/12085 |
| og:image:alt | Using matploy throught pyplot when I quit my application I've the message : Exception ignored in: |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | firebird631 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width