import matplotlib.pyplot as plt
def onclick(event):
print event.button
fig = plt.figure()
connection_id = fig.canvas.mpl_connect('button_press_event', onclick)
plt.show()
With a construct like this, I have the problem of double-clicks hitting onclick() handler three times. I guess that it is receiving both the clicks, and an additional double-click event. How can I change this behaviour so that the event handler is not fired for double-click events? Or, alternatively, how can I detect them from the event instance so that I can ignore those double-clicks?
note: button_release_event does not have this problem, but I want to fire on the button_press_event