ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Callbacks not triggered when using observe

Open fses91 opened this issue 7 years ago • 7 comments
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

fses91 avatar Jul 25 '18 08:07 fses91