bokeh.models.widgets.buttons — Anaconda Enterprise 4.4 documentation

Anaconda Enterprise: Documentation

# bokeh.models.widgets.buttons

Various kinds of button widgets.

class `bokeh.models.widgets.buttons.` `AbstractButton`(**kwargs)

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

  A base class that defines common properties for all button types.

  Note

  This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

  `callback`

    property type: `Instance` ( `Callback` )

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

  `icon`

    property type: `Instance` ( `AbstractIcon` )

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

  `label`

    property type: `String`

    The text label for the button to display.

JSON Prototype

    {
      "button_type": "default",
      "callback": null,
      "css_classes": null,
      "disabled": false,
      "height": null,
      "icon": null,
      "id": "208b9597-4f85-48a5-a2b8-f2ce095b3827",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "label": "Button",
      "name": null,
      "sizing_mode": "fixed",
      "subscribed_events": [],
      "tags": [],
      "width": null
    }

class `bokeh.models.widgets.buttons.` `Button`(**kwargs)

  Bases: `bokeh.models.widgets.buttons.AbstractButton`

  A click button.

  `clicks`

    property type: `Int`

    A private property used to trigger `on_click` event handler.

  `js_on_click`(handler)

    Set up a JavaScript handler for button clicks.

  `on_click`(handler)

    Set up a handler for button clicks.

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

JSON Prototype

    {
      "button_type": "default",
      "callback": null,
      "clicks": 0,
      "css_classes": null,
      "disabled": false,
      "height": null,
      "icon": null,
      "id": "8e07da47-2136-41a2-b435-44bc606fbac2",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "label": "Button",
      "name": null,
      "sizing_mode": "fixed",
      "subscribed_events": [],
      "tags": [],
      "width": null
    }

class `bokeh.models.widgets.buttons.` `ButtonLike`(**properties)

  Shared properties for button-like widgets.

  Note

  This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

  `button_type`

    property type: `Enum` ( `ButtonType` )

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

class `bokeh.models.widgets.buttons.` `Dropdown`(**kwargs)

  Bases: `bokeh.models.widgets.buttons.AbstractButton`

  A dropdown button.

  `default_value`

    property type: `String`

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

  `menu`

    property type: `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: `String`

    A private property used to trigger `on_click` event handler.

  `js_on_click`(handler)

    Set up a JavaScript handler for button or menu item clicks.

  `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

JSON Prototype

    {
      "button_type": "default",
      "callback": null,
      "css_classes": null,
      "default_value": null,
      "disabled": false,
      "height": null,
      "icon": null,
      "id": "b00bbfe6-0840-4ad6-be30-9827f6850092",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "label": "Dropdown",
      "menu": [],
      "name": null,
      "sizing_mode": "fixed",
      "subscribed_events": [],
      "tags": [],
      "value": null,
      "width": null
    }

class `bokeh.models.widgets.buttons.` `Toggle`(**kwargs)

  Bases: `bokeh.models.widgets.buttons.AbstractButton`

  A two-state toggle button.

  `active`

    property type: `Bool`

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

  `js_on_click`(handler)

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

  `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

JSON Prototype

    {
      "active": false,
      "button_type": "default",
      "callback": null,
      "css_classes": null,
      "disabled": false,
      "height": null,
      "icon": null,
      "id": "25b657a7-0855-494a-869a-4720a15ce17e",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "label": "Toggle",
      "name": null,
      "sizing_mode": "fixed",
      "subscribed_events": [],
      "tags": [],
      "width": null
    }