bokeh.models.widgets.buttons

Various kinds of button widgets.

class AbstractButton(**kwargs)

Bases: bokeh.models.widgets.widget.Widget, bokeh.models.widgets.buttons.ButtonLike

A base class that defines common properties for all button types. AbstractButton is not generally useful to instantiate on its own.

callback

property type: callback:Instance(Callback)

A callback to run in the browser whenever the button is activated.

icon

property type: icon:Instance(AbstractIcon)

An optional image appearing to the left of button’s text.

label

property type: label:String

The text label for the button to display.

JSON Prototype
{
  "button_type": "default",
  "callback": null,
  "disabled": false,
  "height": null,
  "icon": null,
  "id": "e586edbb-5960-467e-ad30-4546317a0cf2",
  "label": "Button",
  "name": null,
  "sizing_mode": "fixed",
  "tags": [],
  "width": null
}
class Button(**kwargs)

Bases: bokeh.models.widgets.buttons.AbstractButton

A click button.

on_click(handler)

Set up a handler for button clicks.

Parameters:handler (func) – handler function to call when button is clicked.
Returns:None
clicks

property type: clicks:Int

A private property used to trigger on_click event handler.

JSON Prototype
{
  "button_type": "default",
  "callback": null,
  "clicks": 0,
  "disabled": false,
  "height": null,
  "icon": null,
  "id": "759c927b-4273-49f7-b136-efb23dca66c6",
  "label": "Button",
  "name": null,
  "sizing_mode": "fixed",
  "tags": [],
  "width": null
}
class ButtonLike(**properties)

Shared properties for button-like widgets.

button_type

property type: button_type:Enum(‘default’, ‘primary’, ‘success’, ‘warning’, ‘danger’, ‘link’)

A style for the button, signifying it’s role.

type
class Dropdown(**kwargs)

Bases: bokeh.models.widgets.buttons.AbstractButton

A dropdown button.

on_click(handler)

Set up a handler for button or menu item clicks.

Parameters:handler (func) – handler function to call when button is activated.
Returns:None
default_value

property type: default_value:String

The default value, otherwise the first item in menu will be used.

menu

property type: menu:List(Tuple(String, String))

Button’s dropdown menu consisting of entries containing item’s text and value name. Use None as a menu separator.

value

property type: value:String

A private property used to trigger on_click event handler.

JSON Prototype
{
  "button_type": "default",
  "callback": null,
  "default_value": null,
  "disabled": false,
  "height": null,
  "icon": null,
  "id": "e8cb5bea-e6f9-408b-a884-d7e3fc9d1483",
  "label": "Dropdown",
  "menu": [],
  "name": null,
  "sizing_mode": "fixed",
  "tags": [],
  "value": null,
  "width": null
}
class Toggle(**kwargs)

Bases: bokeh.models.widgets.buttons.AbstractButton

A two-state toggle button.

on_click(handler)

Set up a handler for button state changes (clicks).

Parameters:handler (func) – handler function to call when button is toggled.
Returns:None
active

property type: active:Bool

The initial state of a button. Also used to trigger on_click event handler.

JSON Prototype
{
  "active": false,
  "button_type": "default",
  "callback": null,
  "disabled": false,
  "height": null,
  "icon": null,
  "id": "dacb6ed3-ecd6-42c9-bc06-959c5ce08ef0",
  "label": "Toggle",
  "name": null,
  "sizing_mode": "fixed",
  "tags": [],
  "width": null
}