Does matplotlib.animation module use weakrefs?

Hello,

I'm trying to run a rudimentary animation code (http://pastebin.com/ZNRhDmPR). When I don't explicitly give a name to the FuncAnimation object, the code doesn't work. I mean, just dropping in:
anim.FuncAnimation(fig, update_figure, np.arange(0, 2*np.pi, 0.1), interval=50)

instead of,

line_anim = anim.FuncAnimation(fig, update_figure, np.arange(0, 2*np.pi, 0.1), interval=50)

The way I see it, since both call the constructor and I don't reuse the object anywhere else, both should work, unless the code uses some weakrefs somewhere. If not, why isn't it working?

Thanks!

Bernhard.

When you don't give the animation object a name, immediately following creation nothing is referencing the animation, so it is destroyed.

Ryan

ยทยทยท

On Feb 29, 2012, at 20:00, Bernhard Heijstek <bernhard.heijstek@...9...> wrote:

Hello,

I'm trying to run a rudimentary animation code (#! /usr/bin/pythonimport numpy as npimport matplotlib.pyplot as pltimpor - Pastebin.com). When I don't explicitly give a name to the FuncAnimation object, the code doesn't work. I mean, just dropping in:
anim.FuncAnimation(fig, update_figure, np.arange(0, 2*np.pi, 0.1), interval=50)

instead of,

line_anim = anim.FuncAnimation(fig, update_figure, np.arange(0, 2*np.pi, 0.1), interval=50)

The way I see it, since both call the constructor and I don't reuse the object anywhere else, both should work, unless the code uses some weakrefs somewhere. If not, why isn't it working?