The IPyWidget
pane renders any ipywidgets model both in the notebook and in a deployed server. This makes it possible to leverage this growing ecosystem directly from within Panel simply by wrapping the component in a Pane or Panel.
In the notebook this is not necessary since Panel simply uses the regular notebook ipywidget renderer. Particularly in JupyterLab importing the ipywidgets extension in this way may interfere with the UI and render the JupyterLab UI unusable, so enable the extension with care.
Parameters:
For details on other options for customizing the component see the layout and styling how-to guides.
object
(object): The ipywidget object being displayed
Display
default_layout
(pn.layout.Panel, default=Row): Layout to wrap the plot and widgets in
The panel
function will automatically convert any ipywidgets
object into a displayable panel, while keeping all of its interactive features:
Interactivity and callbacks
Any ipywidget with a value
parameter can also be used in a pn.depends
decorated callback, e.g. here we declare a function that depends on the value of a FloatSlider
:
If instead you want to write a callback yourself you can also use the traitlets
observe
method as you would usually. To read more about this see the Widget Events section of the ipywidgets documentation.
External widget libraries
The IPyWidget
panel is also not restricted to simple widgets, ipywidget libraries such as ipyvolume
and ipyleaflet
are also supported.
Limitations
The ipywidgets support has some limitations because it is integrating two very distinct ecosystems. In particular it is not yet possible to set up JS-linking between a Panel and an ipywidget object or support for embedding. These limitations are not fundamental technical limitations and may be solved in future.