-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Description
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
n = 0
def printer(event):
global n
print(f'in event {event}')
n += 1
fig.canvas.mpl_connect('button_press_event', printer)
when run in IPython prints out to stdout on every mouse click. In jlab + ipympl the prints don't show up anywhere I can find...
From https://ipywidgets.readthedocs.io/en/stable/examples/Output%20Widget.html it looks like this can work via:
output = widgets.Output()
display(fig.canvas, output)
n = 0
def printer(event):
global n
with output:
print(f'in event {event}')
n += 1
fig.canvas.mpl_connect('button_press_event', printer)
but I suspect there is a way for this to work automatically....
kiryph
Metadata
Metadata
Assignees
Labels
No labels