This docs on this page refers to a PREVIOUS VERSION. For the latest stable release, go to https://docs.bokeh.org/

Archived docs for versions <= 1.0.4 have had to be modified from their original published configuration, and may be missing some features (e.g. source listing)

All users are encourage to update to version 1.1 or later, as soon as they are able.

Bokeh Docs

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": "304a4291-dadc-477e-a363-f10c8fe86a1c",
  "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": "b2a2be28-4fed-408b-a8fe-c22bf3889c8b",
  "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": "674583b0-04a0-4a99-b2f8-99d9a73b1a24",
  "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": "b46f286a-f00b-4ff4-92a6-237da7d0bbb1",
  "label": "Toggle",
  "name": null,
  "sizing_mode": "fixed",
  "tags": [],
  "width": null
}