| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I'm pretty sure that comment from 2004 about anim.py actually predates the current animation module. |
Sorry, something went wrong.
Apparently, with a small enough animation interval, tk does not have the time to fully proceed through FigureManagerTkAgg.show before the animation takes over. Removing the call to self.window.update (which had been added back in 2004 (6c96389), but seems unnecessary (including on Windows)) fixes the issue. Also update the animation example so that it can serve as manual test for the issue; changed the rate at which the data moves to keep it reasonable, and switched to None (= count()) as index iterable to avoid a jump every time we reach the end of the indices.
This provides the same method name as in the other backends.
|
On OS X, the following (test) efiring@manini2:~/work/programs/py/mpl/matplotlib/examples/animation$ ipython
Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:52:12)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import matplotlib
In [2]: matplotlib.use('tkagg')
In [3]: run simple_anim.py
hangs with a spinning ball when I close the window with the window manager button. Control-C ends it. |
Sorry, something went wrong.
|
I see that this patch also adds an error message in the same context as given by @efiring but on Linux: invalid command name "140521287480648_on_timer"
while executing
"140521287480648_on_timer"
("after" script)
which is not solved by #9956 either. We probably need to look into clearing the timers at destroy time too. Registering the Timers in a (weak)set and stopping them the the figuremanager's destroy hook doesn't seem to help. |
Sorry, something went wrong.
| key_press_handler(event, canvas, toolbar) | ||
|
|
||
| canvas.mpl_connect('key_press_event', on_key_event) | ||
| canvas.mpl_connect( |
There was a problem hiding this comment.
some debugging code?
Sorry, something went wrong.
There was a problem hiding this comment.
Either way works but I guess the previous one looks a bit better. Reverting.
Sorry, something went wrong.
embedding_in_tk2_sgskip is essentially a slightly simplified duplicate of embedding_in_tk_sgskip.
|
Actually, this is the situation on Linux:
So from this point of view the PR is strictly better, even though it doesn't fix all issues. Perhaps I can just switch back the example to use an slow timer if the failure mode is more severe on OSX than on Linux (but the same as before the removal of the call to update()). |
Sorry, something went wrong.
|
Some further research pointed to https://bugs.python.org/issue1252236 (by Matplotlib's own @mdehoon :-)) which indicates that tkinter only checks for events every 20ms (the line static int Tkinter_busywaitinterval = 20; is still present in the sources); and, indeed, it looks like the erroneous behavior starts to appear as the interval goes from above 20ms to below (I tried 25 and 15; at 15 you may need to try a few times before reproducing into the issue, probably because this presumably requires some whole interval to occur between two event checks, or something similar). This doesn't mean that the issue is necessarily unsolvable, but may point out why certain attempts don't work... |
Sorry, something went wrong.
|
Would be nice to get this in so that I can make a tkcairo PR that doesn't cause conflicts with this. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Fix tkagg animation error at exit.
Apparently, with a small enough animation interval, tk does not have the
time to fully proceed through FigureManagerTkAgg.show before the animation
takes over. Removing the call to self.window.update (which had been added
back in 2004 (6c96389), but seems unnecessary (including on Windows)) fixes
the issue (#8107).
Also update the animation example so that it can serve as manual test for
the issue; changed the rate at which the data moves to keep it reasonable,
and switched to None (= count()) as index iterable to avoid a jump every
time we reach the end of the indices.
Deprecations in tkagg.
width and height separately). This has been "deprecated in comment" for a
while and is consistent with other backends.
method name as in the other backends.
Cleanup embedding_in_tk, remove embedding_in_tk2.
embedding_in_tk2_sgskip is essentially a slightly simplified duplicate of
embedding_in_tk_sgskip.
PR Checklist