[Matplotlib-users] Asyncio, Tk, and matplotlib
Ludwig Schwardt
ludwig.schwardt at gmail.com
Thu Feb 23 15:44:40 EST 2017
Hi Juan,
Funny that you should mention it... I was busy with the exact same thing
today :-)
It is as you said: the matplotlib GUI has to run on the main thread. The
trick seems to be to start the asyncio loop in a second background thread
and communicate with the GUI running on the main thread via a queue. I
found this <http://stackoverflow.com/a/34882411> StackOverflow answer very
helpful.
As an aside, I eventually ditched asyncio for an even simpler threading +
queue solution (being stuck in Python 2.7...).
Cheers,
Ludwig
P.P.S. I have an old matplotlib GUI app that used to disable the button
during the long-running task (run from the on_clicked callback) to indicate
when the GUI becomes available again. This behaviour does not seem to work
anymore on modern matplotlib, hence my need to investigate background
threads :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170223/28651b44/attachment.html>
More information about the Matplotlib-users
mailing list