If you know how many frames there are in your image data, then make sure that among the other arguments in FuncAnimation()you have:
frames=#frames
repeat=False
Then it stops when it reaches the limit of the frame. Not perfect, but it seems like a common problem without the right solution.
source
share