Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python - Stop FuncAnimation

Does anyone know the preferred method for stopping FuncAnimation? I am using it to record data from a oscilloscope and would like to be able to pause and restart the data on demand. Is there any way I can send a button click event to it?

Thanks, Derek

like image 783
tesla Avatar asked Feb 13 '23 17:02

tesla


1 Answers

The FuncAnimation is a subclass of TimedAnimation. It takes frames as an input for update functionm, which could be a number or a generator. It takes repeat as an argument, which is inherited from TimedAnimation, by setting reapeat to False you could stop the animation to repeat itself.

PS: Matplotlib documentation is lame, mistakes, lazy writing style, unclear explanation. Sometime, I really have to dig into the source code to figure out what to do.

Like FuncAnimation, it also takes fargs as an extra arguments for update function, but in its documentation, it doesn't say the type of fargs. In fact, what I found in its source code, fargs is used as a list.

like image 105
Hualin Avatar answered Feb 17 '23 11:02

Hualin