IPython Documentation

Table Of Contents

Previous topic

Module: html.widgets.widget_box

Next topic

Module: html.widgets.widget_float

This Page

Module: html.widgets.widget_button

Button class.

Represents a button in the frontend using a widget. Allows user to listen for click events on the button and trigger backend code when the clicks are fired.

1 Class

class IPython.html.widgets.widget_button.Button(**kwargs)

Bases: IPython.html.widgets.widget.DOMWidget

Button widget.

This widget has an on_click method that allows you to listen for the user clicking on the button. The click event itself is stateless.



on_click(callback, remove=False)

Register a callback to execute when the button is clicked.

The callback will be called with one argument, the clicked button widget instance.


remove : bool (optional)

Set to true to remove the callback from the list of callbacks.