Matplotlib - Interactive Features
What is wrong with this button widget code?
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
fig, ax = plt.subplots()
button_ax = plt.axes([0.7, 0.05, 0.1, 0.075])
button = Button(button_ax, 'Press')
button.on_clicked(on_press)
def on_press(event):
print('Button pressed')