ipywidgets
ipywidgets copied to clipboard
Callbacks not triggered when using observe
trafficstars
Hi I have the following problem.
When I use:
import ipywidgets as widgets
toggle = widgets.ToggleButton(description='click me')
def on_click(change):
print(change['new'])
toggle.observe(on_click, 'value')
the callback does not get triggered, but if I use
import ipywidgets as widgets
@interact
def clicked(a=widgets.ToggleButton()):
print(a)
the call back gets triggered.
I am using Jupyter Lab: Jupyter Notebook version: 5.6.0 ipywidgets version: 7.2.1