Matplotlib - Interactive Features
What will be the value of the variable
pressed after clicking the button in this code snippet?import matplotlib.pyplot as plt
from matplotlib.widgets import Button
fig, ax = plt.subplots()
button_ax = plt.axes([0.8, 0.05, 0.1, 0.075])
button = Button(button_ax, 'Press')
pressed = False
def on_press(event):
global pressed
pressed = True
button.on_clicked(on_press)
button.eventson = True
# Simulate a button click here
button._click(event=None)
print(pressed)