Ipywidget in kernel-output extension doesn't work

Is it possible to show custom widgets in the output panel of an extension like extension-examples/kernel-output at main · jupyterlab/extension-examples · GitHub ? I see only a text representation instead of the actual widget.

Steps to reproduce:

  • I installed that kernel-output extension,
  • executed this code in the notebook:

import ipywidgets as widgets
from IPython.display import display
w = widgets.IntSlider()
display(w)

  • then opened the kernel output panel
  • selected “Contact Kernel and Execute Code” from the extension menu
  • selected the notebook’s kernel
  • and typed “display(w)” as the “Code to execute”. (I also tried “w” instead of “display(w)”.)

Instead of showing the slider in the kernel output panel, only a text “IntSlider(value=0)” is displayed there:

Probably I am doing something obviously wrong?

Thank you
Kevin

I am unfamiliar with that extension, but there is a dedicated jupyterlab-sidecar for collecting widgets in a sidebar, though I don’t think it re-displays them automatically.

Of note, the Output widget can re-display any other kind of output (except, maybe, other Widgets?), so perhaps the two can be combined for the present need.