title: matplotlib interactive mode: determine if figure window is still displayed
body: <p>I am using matplotlib in interactive mode to show the user a plot that will help them enter a range of variables. They have the option of hitting "?" to show this plot, and the prompt for variables will then be repeated. </p>
  
  <p>How do I know to not re-draw this plot if it's still being displayed? </p>
  
  <p>Superficially, I have this clunky (pseudo-ish) code:</p>
  
  <pre><code>answer = None
  done_plot = False
  while answer == None:
      answer = get_answer()
      if answer == '?':
          if done_plot:
              have_closed = True
              ##user's already requested a plot - has s/he closed it?
              ## some check here needed:
              have_closed = ?????
  
              if have_closed == False:
                  print 'You already have the plot on display, will not re-draw'
                  answer = None
                  continue
          plt.ion()
          fig = plt.figure()
          ### plotting stuff
          done_plot = True
          answer = None
      else:
          ###have an answer from the user...
  </code></pre>
  
  <p>what can I use (in terms of plt.gca(), fig etc...) to determine if I need to re-plot? Is there a status somewhere I can check?</p>
  
  <p>Many thanks,</p>
  
  <p>David</p>