panel.io.notifications module#

class panel.io.notifications.Notification(*, _destroyed, _rendered, background, duration, icon, message, notification_area, notification_type, name)[source]#

Bases: Parameterized

Methods

destroy

Parameter Definitions


background = Color(allow_None=True, allow_named=True, label='Background')

duration = Integer(constant=True, default=3000, inclusive_bounds=(True, True), label='Duration')

icon = String(allow_None=True, label='Icon')

message = String(constant=True, default='', label='Message')

notification_area = Parameter(allow_None=True, constant=True, label='Notification area')

notification_type = String(allow_None=True, constant=True)

_rendered = Boolean(default=False, label=' rendered')

_destroyed = Boolean(default=False, label=' destroyed')

class panel.io.notifications.NotificationArea(*, types, _clear, js_events, notifications, position, 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, name)[source]#

Bases: NotificationAreaBase

Methods

demo()

Generates a layout which allows demoing the component.

Parameter Definitions


Parameters inherited from:

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

panel.viewable.Viewable: loading

panel.io.notifications.NotificationAreaBase: js_events, notifications, position, _clear

types = List(bounds=(0, None), default=[{'type': 'warning', 'background': '#ffc107', 'icon': {'className': 'fas fa-exclamation-triangle', 'tagName': 'i', 'color': 'white'}}, {'type': 'info', 'background': '#007bff', 'icon': {'className': 'fas fa-info-circle', 'tagName': 'i', 'color': 'white'}}], label='Types')

classmethod demo()[source]#

Generates a layout which allows demoing the component.

class panel.io.notifications.NotificationAreaBase(*, _clear, js_events, notifications, position, 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, name)[source]#

Bases: ReactiveHTML

Methods

get_root([doc, comm, preprocess])

Returns the root model and applies pre-processing hooks

send(message[, duration, type, background, icon])

Sends a notification to the frontend.

clear

error

info

success

warning

Parameter Definitions


Parameters inherited from:

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

panel.viewable.Viewable: loading

js_events = Dict(class_=<class 'dict'>, default={}, label='Js events')

A dictionary that configures notifications for specific Bokeh Document events, e.g.: {‘connection_lost’: {‘type’: ‘error’, ‘message’: ‘Connection Lost!’, ‘duration’: 5}} will trigger a warning on the Bokeh ConnectionLost event.

notifications = List(bounds=(0, None), class_=<class 'panel.io.notifications.Notification'>, default=[], item_type=<class 'panel.io.notifications.Notification'>, label='Notifications')

position = Selector(default='bottom-right', label='Position', names={}, objects=['bottom-right', 'bottom-left', 'bottom-center', 'top-left', 'top-right', 'top-center', 'center-center', 'center-left', 'center-right'])

_clear = Integer(default=0, inclusive_bounds=(True, True), label=' clear')

get_root(doc: Document | None = None, comm: Comm | None = None, preprocess: bool = True) Model[source]#

Returns the root model and applies pre-processing hooks

Parameters:
doc: bokeh.Document

Bokeh document the bokeh model will be attached to.

comm: pyviz_comms.Comm

Optional pyviz_comms when working in notebook

preprocess: boolean (default=True)

Whether to run preprocessing hooks

Returns:
Returns the bokeh model corresponding to this panel object
send(message, duration=3000, type=None, background=None, icon=None)[source]#

Sends a notification to the frontend.