panel.widgets.base module#

Defines the Widget base class which provides bi-directional communication between the rendered dashboard and the Widget parameters.

class panel.widgets.base.CompositeWidget(*, disabled, loading, align, aspect_ratio, css_classes, design, height, height_policy, margin, max_height, max_width, min_height, min_width, sizing_mode, styles, stylesheets, tags, visible, width, width_policy, value, name)[source]#

Bases: Widget

A baseclass for widgets which are made up of two or more other widgets

Methods

select([selector])

Iterates over the Viewable and any potential children in the applying the Selector.

Parameter Definitions


Parameters inherited from:

panel.widgets.base.WidgetBase: value

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

panel.widgets.base.Widget: height, margin, width, disabled

select(selector: type | Callable[[Viewable], bool] | None = None) list[Viewable][source]#

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters:
selector: type or callable or None

The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns:
viewables: list(Viewable)
class panel.widgets.base.Widget(**params: Any)[source]#

Bases: Reactive, WidgetBase

Widgets allow syncing changes in bokeh widget models with the parameters on the Widget instance.

Parameter Definitions


Parameters inherited from:

panel.widgets.base.WidgetBase: value

panel.viewable.Layoutable: align, aspect_ratio, css_classes, design, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width_policy, height_policy, sizing_mode, visible

panel.viewable.Viewable: loading

height = Integer(allow_None=True, allow_refs=True, bounds=(0, None), inclusive_bounds=(True, True), label='Height')

The height of the component (in pixels). This can be either fixed or preferred height, depending on height sizing policy.

margin = Margin(allow_None=True, allow_refs=True, default=(5, 10), label='Margin')

Allows to create additional space around the component. May be specified as a two-tuple of the form (vertical, horizontal) or a four-tuple (top, right, bottom, left).

width = Integer(allow_None=True, allow_refs=True, bounds=(0, None), inclusive_bounds=(True, True), label='Width')

The width of the component (in pixels). This can be either fixed or preferred width, depending on width sizing policy.

disabled = Boolean(allow_refs=True, default=False, label='Disabled')

Whether the widget is disabled.

class panel.widgets.base.WidgetBase(*, value, name)[source]#

Bases: Parameterized

WidgetBase provides an abstract baseclass for widget components which can be used to implement a custom widget-like type without implementing the methods associated with a Reactive Panel component, e.g. it may be used as a mix-in to a PyComponent or JSComponent.

Attributes:
rx

Methods

from_param(parameter, **params)

Construct a widget from a Parameter and link the two bi-directionally.

from_values(values, **params)

Creates an instance of this Widget where the parameters are inferred from the data.

Parameter Definitions


value = Parameter(allow_None=True, label='Value')

The widget value which the widget type resolves to when used as a reactive param reference.

classmethod from_param(parameter: param.Parameter, **params) T[source]#

Construct a widget from a Parameter and link the two bi-directionally.

Parameters:
parameter: param.Parameter

A parameter to create the widget from.

Returns:
Widget instance linked to the supplied parameter
classmethod from_values(values, **params)[source]#

Creates an instance of this Widget where the parameters are inferred from the data.

Parameters:
values: Iterable

The values to infer the parameters from.

params: dict

Additional parameters to pass to the widget.