title: Matplotlib.animation.FuncAnimation to iterate a list one time
body: <p>Currently I'm working with a surface to be analyzed, 4000 40x40 frames. Mechanically it is a list of 4000 frames, which are a list of 40 lines, which are a list of 40 data points.</p>
  
  <p>I'm using funcanimation to see how it changes over time, but I'm running into an issue. Basically at this point I have two questions:</p>
  
  <p>1) How can I iterate through the frames one time, eventually to be used for saving it?</p>
  
  <p>2) Why does my current code give me a spinning beachball if I try to exit out of the animation?</p>
  
  <pre><code>def update_fig(*args):
    global currentNum, numSurfaces
    currentNum += 1
    if currentNum &lt; numSurfaces:
      print(currentNum)
    im.set_array(testClass.surfaceList[currentNum])
    return im,
      else:
        pass
  
  
  def updatefig(*args):
    global currentNum, numSurfaces
    currentNum += 1
    if currentNum &gt; numSurfaces - 1:
      currentNum = 0
    print currentNum
    im.set_array(testClass.surfaceList[currentNum])
    return im,
  
  ani = animation.FuncAnimation(fig, updatefig, frames=4000, interval=0.5, repeat=False, blit=False)
  plt.show()
  plt.close()
  </code></pre>