Problem with event handling in matplotlib in tkinter

This came up regrading sliders a while ago: https://github.com/matplotlib/matplotlib/issues/3105 and is one of the persistent gotchas with animation code.

Tom

···

On Fri, Nov 7, 2014 at 10:05 AM, rouckas <stepan.roucka@…985…> wrote:

Thanks for the tip. However, subclassing from object didn’t help.

View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-with-event-handling-in-matplotlib-in-tkinter-tp44302p44315.html
Sent from the matplotlib - users mailing list archive at Nabble.com.



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

There have been some discussion of adding an fig.animations list (a la ax.images, ax.artists), and have a fig.add_animation() method. We could then update the animation code to add itself to the given figure to make this work for all existing code. Maybe it would be a nice tie-in with the updates to the navigation toolbar (automatically adding useful buttons for starting/pausing animations, etc)?

···

On Fri, Nov 7, 2014 at 1:35 PM, Thomas Caswell <tcaswell@…287…> wrote:

This came up regrading sliders a while ago: https://github.com/matplotlib/matplotlib/issues/3105 and is one of the persistent gotchas with animation code.

Tom

On Fri Nov 07 2014 at 12:38:28 PM Benjamin Root <ben.root@…1304…> wrote:

Figured it out! The instance of Test() isn’t being retained anywhere, so when it goes out of scope, the garbage collector eventually gets it. The fact that it works in py3k is likely a coincidence as the garbage collector would eventually have cleaned it up at some point. I don’t know the scoping/garbage collection rules for lambdas, so I am guessing that they persist as they are part of the code as opposed to a de-reference-able (is that even a word?). Just save the instance of Test as a member variable of App, and you should be good to go!

Ben Root



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Fri, Nov 7, 2014 at 10:05 AM, rouckas <stepan.roucka@…287…> wrote:

Thanks for the tip. However, subclassing from object didn’t help.

View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-with-event-handling-in-matplotlib-in-tkinter-tp44302p44315.html
Sent from the matplotlib - users mailing list archive at Nabble.com.



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users