from __future__ import print_function from IPython.html import widgets print(widgets.ButtonWidget.on_click.__doc__) from IPython.display import display button = widgets.ButtonWidget(description="Click Me!") display(button) def on_button_clicked(b): print("Button clicked.") button.on_click(on_button_clicked) text = widgets.TextWidget() display(text) def handle_submit(sender): print(text.value) text.on_submit(handle_submit) print(widgets.Widget.on_trait_change.__doc__) int_range = widgets.IntSliderWidget() display(int_range) def on_value_change(name, value): print(value) int_range.on_trait_change(on_value_change, 'value')