title: Matplotlib Button
body: <p>Matplotlib Widget Buttons event and  fig.canvas.mpl_connect('button_press_event') will both be triggered when mouse is clicked against the button.</p>
  
  <p>My problem are :</p>
  
  <p>1) how to make fig.canvas.mpl_connect('button_press_event') event have a higher priority ? 
  and 
  2) how to tell within an fig.canvas.mpl_connect('button_press_event') event whether the button is being clicked or not. </p>
  
  <pre><code>import matplotlib.pyplot as plt
  from matplotlib.widgets import Slider, Button, RadioButtons
  
  
  fig = plt.figure()
  # plotting
  X=[1,2,3]
  Y=[10,20,30]
  ax  = fig.add_subplot(1, 1, 1)
  ax.plot(X,Y,'bo-')
  ax.grid()
  ax.legend()
  X1=[]
  Y1=[]
  
  def on_press(event):
      print "canvas clicked"
      print "how can I tell whether the button is clicked?"
      print event
  def on_button_clicked(event):
      print "button clicked"
      print event
  axnext = plt.axes([0.81, 0.05, 0.1, 0.075])
  bnext = Button(axnext, 'Next')
  bnext.on_clicked(on_button_clicked)
  fig.canvas.mpl_connect('button_press_event', on_press)
  plt.show()
  </code></pre>