Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Tkagg fixes#9275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Tkagg fixes#9275
Uh oh!
There was an error while loading.Please reload this page.
Conversation
I'm pretty sure that comment from 2004 about |
Apparently, with a small enough animation interval, tk does not havethe time to fully proceed through FigureManagerTkAgg.show before theanimation takes over. Removing the call to self.window.update (whichhad been added back in 2004 (6c96389), but seems unnecessary (includingon Windows)) fixes the issue.Also update the animation example so that it can serve as manual testfor the issue; changed the rate at which the data moves to keep itreasonable, and switched to None (= count()) as index iterable to avoida 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
hangs with a spinning ball when I close the window with the window manager button. Control-C ends it. |
I see that this patch also adds an error message in the same context as given by@efiring but on Linux:
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. |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
some debugging code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Either way works but I guess the previous one looks a bit better. Reverting.
embedding_in_tk2_sgskip is essentially a slightly simplified duplicateof 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()). |
Some further research pointed tohttps://bugs.python.org/issue1252236 (by Matplotlib's own@mdehoon :-)) which indicates that tkinter only checks for events every 20ms (the line This doesn't mean that the issue is necessarily unsolvable, but may point out why certain attempts don't work... |
Would be nice to get this in so that I can make a tkcairo PR that doesn't cause conflicts with this. |
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 ofembedding_in_tk_sgskip
.PR Checklist