title: How to prompt for user input using a Matplotlib GUI rather than a command line prompt
body: <p>Suppose I to write a function <code>get_coords</code> which prompts the user for some input coordinates. One way to do this would be as follows:</p>
  
  <pre><code>def get_coords():
      coords_string = input("What are your coordinates? (x,y)")
      coords = tuple(coords_string)
      return coords
  </code></pre>
  
  <p>However, I'd like to use this using a GUI rather than the command line. I've tried the following:</p>
  
  <pre><code>def onclick(event):
      return (event.x, event.y)
  
  def get_coords_from_figure():
      fig = plt.figure()
      plt.axvline(x=0.5)      # Placeholder data
      plt.show(block=False)
      cid = fig.canvas.mpl_connect('button_press_event', onclick)
  </code></pre>
  
  <p>However, using <code>coords = get_coords_from_figure()</code> results in a <code>coords</code> variable which is empty, unlike if I use <code>coords = get_coords()</code>, because the <code>input</code> function waits for user input.</p>
  
  <p>How could I prompt a user for input using a GUI?</p>