import matplotlib.pyplot as pltdef onclick(event): print(event.button)fig = plt.figure()connection_id = fig.canvas.mpl_connect('button_press_event', onclick)plt.show()
With this code, the problem is double-clicks are hitting onclick()
handler three times. I guess that it is receiving both the clicks, as well as an additional double-click event.
How can I change this behavior so that the event handler is not fired for double-click events? Alternatively, how can I detect a double-click from the event instance so that I can ignore that case?
Note: button_release_event
does not have this problem, but I want to fire on the button_press_event