Matplotlib - Interactive Features
The following code is intended to print the mouse button pressed, but it raises an error:
What is the error and how to fix it?
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
def on_click(event):
print(f"Button pressed: {event.button}")
fig.canvas.mpl_connect('button_press_event', on_click())
plt.show()What is the error and how to fix it?
