title: How to set timeout to pyplot.show() in matplotlib?
body: <p>I am using python's <code>matplotlib</code> to draw figures.</p>
  
  <p>I want to draw a figure with a timeout, say 3 seconds, and the window will close to move on the code.</p>
  
  <p>I have known that <code>pyplot.show()</code> will create a blocking window with unlimited timeout; <code>pyplot.show(block=False)</code> or <code>pyplot.draw()</code> will make the window non-blocking. But what I want is let the code block for some seconds.</p>
  
  <p>I have come up an idea that I might use an event handler or something, but still not really clear how to solve this. Is there any simple and elegant solution?</p>
  
  <p>Suppose my code is like the following:</p>
  
  <p>Draw.py:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  #Draw something
  plt.show() #Block or not?
  </code></pre>