title: Show GIF and wait for key press
body: <p>I'm trying to automate the labelization of sequences of images. I need to sort them relative to a certain number, which can be found easily by a human operator. </p>
  
  <p>My idea is to show, for each sequence, a gif (pops up on screen), have the operator press a digit key, and then copy the sequence to the correct location, and pop another gif, etc.</p>
  
  <p>For now, I managed to show gifs, and to wait for button press, but I can't get the exact key that was pressed... </p>
  
  <p>Any idea how to do that ? And I'd like to be able to press the key while having the gif on front, not in the terminal...</p>
  
  <p>Here's my code :</p>
  
  <pre><code>    fig = plt.figure()
      for img in sequence:
          im = plt.imshow(img_array,animated=True,cmap='gray')
          ims.append([im])
  
      ani = animation.ArtistAnimation(fig,ims,interval=50,blit=True,repeat_delay=1000)
      plt.draw()
      plt.pause(1)
      n = raw_input("how many?")
      plt.close(fig) ## shows all the gifs at once, opening multiple windows.
  </code></pre>