bokeh.models.widgets.inputs

Various kinds of input widgets and form controls.

class AutocompleteInput(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.TextInput

Single-line input widget with auto-completion.

completions

property type: List ( String )

A list of completion strings. This will be used to guide the user upon typing the beginning of a desired value.

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "completions": [],
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14455",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "placeholder": "",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": "",
  "value_input": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class ColorPicker(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.InputWidget

Color picker widget

Warning

This widget as a limited support on Internet Explorer (it will be displayed as a simple text input).

callback

property type: Instance ( Callback )

A callback to run in the browser whenever the current date value changes.

color

property type: ColorHex

The initial color of the picked color (named or hexadecimal)

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "color": "#000000",
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14457",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class DatePicker(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.InputWidget

Calendar-based date picker widget.

callback

property type: Instance ( Callback )

A callback to run in the browser whenever the current date value changes.

max_date

property type: Date

Optional latest allowable date.

min_date

property type: Date

Optional earliest allowable date.

value

property type: Date

The initial or picked date.

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14460",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_date": null,
  "max_height": null,
  "max_width": null,
  "min_date": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": null,
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class FileInput(**kwargs)[source]

Bases: bokeh.models.widgets.widget.Widget

Present a file-chooser dialog to users and return the contents of a selected file.

accept

property type: String

Comma-separated list of standard HTML file input filters that restrict what files the user can pick from. Values can be:

<file extension>:

Specific file extension(s) (e.g: .gif, .jpg, .png, .doc) are pickable

audio/*:

all sound files are pickable

video/*:

all video files are pickable

image/*:

all image files are pickable

<media type>:

A valid IANA Media Type, with no parameters.

filename

property type: String

The filename of the selected file. The file path is not included as browsers do not allow access to it.

mime_type

property type: String

The mime type of the selected file.

value

property type: String

A base64-encoded string of the contents of the selected file.

JSON Prototype
{
  "accept": "",
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14465",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class InputWidget(**kwargs)[source]

Bases: bokeh.models.widgets.widget.Widget

Abstract base class for input 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.

title

property type: String

Widget’s label.

classmethod coerce_value(val)[source]
JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14470",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class MultiSelect(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.InputWidget

Multi-select widget.

callback

property type: Instance ( Callback )

A callback to run in the browser whenever the current selection value changes.

options

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

Available selection options. Options may be provided either as a list of possible string values, or as a list of tuples, each of the form (value, label). In the latter case, the visible widget text for each value will be corresponding given label.

size

property type: Int

The number of visible options in the dropdown list. (This uses the select HTML element’s size attribute. Some browsers might not show less than 3 options.)

value

property type: List ( String )

Initial or selected values.

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14472",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "options": [],
  "orientation": "horizontal",
  "size": 4,
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": [],
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class PasswordInput(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.TextInput

Single-line password input widget. Note: Despite PasswordInput inheriting from TextInput the password cannot be inspected on the field value. Also, note that this field functionally just hides the input on the browser, transmitting safely a password as a callback, e.g., to a bokeh server would require some secure connection.

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14477",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "placeholder": "",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": "",
  "value_input": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class Select(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.InputWidget

Single-select widget.

callback

property type: Instance ( Callback )

A callback to run in the browser whenever the current Select dropdown value changes.

options

property type: Either ( List ( Either ( String , Tuple ( Either ( Int , String ), String ) ) ), Dict ( String , List ( Either ( String , Tuple ( Either ( Int , String ), String ) ) ) ) )

Available selection options. Options may be provided either as a list of possible string values, or as a list of tuples, each of the form (value, label). In the latter case, the visible widget text for each value will be corresponding given label. Option groupings can be provided by supplying a dictionary object whose values are in the aforementioned list format

value

property type: String

Initial or selected value.

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14478",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "options": [],
  "orientation": "horizontal",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class Spinner(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.InputWidget

Spinner widget for numerical inputs

callback

property type: Instance ( Callback )

A callback to run in the browser whenever the user unfocuses the SpinBox widget by hitting Enter or clicking outside of the box area.

high

property type: Float

Optional highest allowable value.

low

property type: Float

Optional lowest allowable value.

step

property type: Float

The step added or subtracted to the current value

value

property type: Float

The initial value of the spinner

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "high": null,
  "id": "14482",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "low": null,
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "sizing_mode": null,
  "step": 1,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": 0,
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class TextInput(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.InputWidget

Single-line input widget.

callback

property type: Instance ( Callback )

A callback to run in the browser whenever the user unfocuses the TextInput widget by hitting Enter or clicking outside of the text box area.

DEPRECATED: use .js_on_change or .on_change with “value” or “value_input”

placeholder

property type: String

Placeholder for empty input field.

value

property type: String

Initial or entered text value.

value_input

property type: String

Initial or entered text value that triggers a callback whenever the value changes.

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14488",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "placeholder": "",
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": "",
  "value_input": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}
class TextAreaInput(**kwargs)[source]

Bases: bokeh.models.widgets.inputs.TextInput

Multi-line input widget.

cols

property type: Int

Specifies the width of the text area (in average character width). Default: 20

max_length

property type: Int

Max count of characters in field

rows

property type: Int

Specifies the height of the text area (in lines). Default: 2

JSON Prototype
{
  "align": "start",
  "aspect_ratio": null,
  "background": null,
  "callback": null,
  "cols": 20,
  "css_classes": [],
  "default_size": 300,
  "disabled": false,
  "height": null,
  "height_policy": "auto",
  "id": "14493",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "margin": [
    5,
    5,
    5,
    5
  ],
  "max_height": null,
  "max_length": 500,
  "max_width": null,
  "min_height": null,
  "min_width": null,
  "name": null,
  "orientation": "horizontal",
  "placeholder": "",
  "rows": 2,
  "sizing_mode": null,
  "subscribed_events": [],
  "tags": [],
  "title": "",
  "value": "",
  "value_input": "",
  "visible": true,
  "width": null,
  "width_policy": "auto"
}