bokeh.document.events

Provide events that represent various changes to Bokeh Documents.

These events are used internally to signal changes to Documents. For information about user-facing (e.g. UI or tool) events, see the reference for bokeh.events.

class bokeh.document.events.ColumnDataChangedEvent(document, column_source, cols=None, setter=None)

A concrete event representing efficiently replacing all existing data for a ColumnDataSource

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._column_data_changed if it exists.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

{
    'kind'          : 'ColumnDataChanged'
    'column_source' : <reference to a CDS>
    'new'           : <new data to steam to column_source>
    'cols'          : <specific columns to update>
}
Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.ColumnsPatchedEvent(document, column_source, patches, setter=None)

A concrete event representing efficiently applying data patches to a ColumnDataSource

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._columns_patched if it exists.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

{
    'kind'          : 'ColumnsPatched'
    'column_source' : <reference to a CDS>
    'patches'       : <patches to apply to column_source>
}
Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.ColumnsStreamedEvent(document, column_source, data, rollover, setter=None)

A concrete event representing efficiently streaming new data to a ColumnDataSource

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._columns_streamed if it exists.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

{
    'kind'          : 'ColumnsStreamed'
    'column_source' : <reference to a CDS>
    'data'          : <new data to steam to column_source>
    'rollover'      : <rollover limit>
}
Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.DocumentChangedEvent(document, setter=None)

Base class for all internal events representing a change to a Bokeh Document.

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._document_changed if it exists.

class bokeh.document.events.DocumentPatchedEvent(document, setter=None)

A Base class for events that represent updating Bokeh Models and their properties.

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._document_patched if it exists.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

Sub-classes must implement this method.

Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.ModelChangedEvent(document, model, attr, old, new, serializable_new, hint=None, setter=None)

A concrete event representing updating an attribute and value of a specific Bokeh Model.

This is the “standard” way of updating most Bokeh model attributes. For special casing situations that can optimized (e.g. streaming, etc.), a hint may be supplied that overrides normal mechanisms.

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._document_model_dhanged if it exists.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.RootAddedEvent(document, model, setter=None)

A concrete event representing a change to add a new Model to a Document’s collection of “root” models.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

{
    'kind'  : 'RootAdded'
    'title' : <reference to a Model>
}
Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.RootRemovedEvent(document, model, setter=None)

A concrete event representing a change to remove an existing Model from a Document’s collection of “root” models.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

{
    'kind'  : 'RootRemoved'
    'title' : <reference to a Model>
}
Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.

class bokeh.document.events.SessionCallbackAdded(document, callback)

A concrete event representing a change to add a new callback (e.g. periodic, timeout, or “next tick”) to a Document.

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._session_callback_added if it exists.

class bokeh.document.events.SessionCallbackRemoved(document, callback)

A concrete event representing a change to remove an existing callback (e.g. periodic, timeout, or “next tick”) from a Document.

dispatch(receiver)

Dispatch handling of this event to a receiver.

This method will invoke receiver._session_callback_removed if it exists.

class bokeh.document.events.TitleChangedEvent(document, title, setter=None)

A concrete event representing a change to the title of a Bokeh Document.

generate(references, buffers)

Create a JSON representation of this event suitable for sending to clients.

{
    'kind'  : 'TitleChanged'
    'title' : <new title to set>
}
Parameters:
  • references (dict[str, Model]) –

    If the event requires references to certain models in order to function, they may be collected here.

    This is an “out” parameter. The values it contains will be modified in-place.

  • buffers (set) –

    If the event needs to supply any additional Bokeh protocol buffers, they may be added to this set.

    This is an “out” parameter. The values it contains will be modified in-place.