Warning

This documentation is for an old version of IPython. You can find docs for newer versions here.

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.

Parameters:

description : str

description displayed next to the button

tooltip: str

tooltip caption of the toggle button

icon: str

font-awesome icon name

__init__(**kwargs)

Constructor

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.

Parameters:

remove : bool (optional)

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