panel.io.model module#
Utilities for manipulating bokeh models.
- panel.io.model.add_to_doc(obj: Model, doc: Document, hold: bool = False, skip: set[Model] | None = None)[source]#
Adds a model to the supplied Document removing it from any existing Documents.
- panel.io.model.bokeh_repr(obj: Model, depth: int = 0, ignored: Iterable[str] | None = None) str [source]#
Returns a string repr for a bokeh model, useful for recreating panel objects using pure bokeh.
- class panel.io.model.comparable_array[source]#
Bases:
ndarray
Array subclass that allows comparisons.
- panel.io.model.diff(doc: Document, binary: bool = True, events: list[DocumentChangedEvent] | None = None) Message[Any] | None [source]#
Returns a json diff required to update an existing plot with the latest plot data.
- panel.io.model.hold(doc: Document | None = None, policy: HoldPolicyType = 'combine', comm: Comm | None = None)[source]#
Context manager that holds events on a particular Document allowing them all to be collected and dispatched when the context manager exits. This allows multiple events on the same object to be combined if the policy is set to ‘combine’.
- Parameters:
- doc: Document
The Bokeh Document to hold events on.
- policy: HoldPolicyType
One of ‘combine’, ‘collect’ or None determining whether events setting the same property are combined or accumulated to be dispatched when the context manager exits.
- comm: Comm
The Comm to dispatch events on when the context manager exits.
- panel.io.model.monkeypatch_events(events: Sequence[DocumentChangedEvent]) None [source]#
Patch events applies patches to events that are to be dispatched avoiding various issues in Bokeh.