ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

widget.on_displayed callback not called when set using the children property of a box

Open govinda18 opened this issue 3 years ago • 0 comments

Description

The widget.on_displayed callback is not called when set using the children property of a box

Reproduce

import ipywidgets as w

# fun is never called here
def fun(widget):
    print("Displayed")

x = w.HTML("<h1>asd</h1>")
x.on_displayed(fun)
b = w.Box([])
display(b)
b.children = [x]

Expected behavior

The function should be called ideally because the widget is now displayed

Context

  • ipywidgets version: 7.7.0
  • Operating System and version: Windows
  • Browser and version: Chrome 100.0.4896.127

If using JupyterLab

  • JupyterLab version: 3.3.0
Installed Labextensions
        bqplot v0.5.33 enabled OK (python, bqplot)
        jupyter-leaflet v0.15.0 enabled OK
        jupyter-matplotlib v0.10.4 enabled OK
        jupyter-threejs v2.3.0 enabled OK (python, pythreejs)
        jupyter-vue v1.7.0 enabled OK
        jupyter-vuetify v1.8.1 enabled OK
        jupyter-webrtc v0.6.0 enabled OK
        jupyterlab-datawidgets v7.0.0 enabled OK
        jupyterlab-execute-time v2.1.0 enabled OK (python, jupyterlab_execute_time)
        jupyterlab-filesearch v4.0.1 enabled OK (python, jupyterlab-filesearch)
        jupyterlab-jupytext v1.3.4 enabled OK (python, jupytext)
        jupyterlab-limit-output v1.0.0 enabled OK (python, jupyterlab_limit_output)
        jupyterlab-notify v1.0.0 enabled OK (python, jupyterlab_notify)
        jupyterlab-plotly v5.5.0 enabled OK
        jupyterlab-skip-traceback v4.0.0 enabled OK (python, jupyterlab-skip-traceback)
        jupyterlab-theme-solarized-dark v2.0.1 enabled OK (python, jupyterlab_theme_solarized_dark)
        jupyterlab_templates v0.3.1 enabled OK
        nbdime-jupyterlab v2.1.0 enabled OK
        @axlair/jupyterlab_vim v0.14.5 enabled OK (python, jupyterlab_vim)
        @ijmbarr/jupyterlab_spellchecker v0.7.2 enabled OK (python, jupyterlab-spellchecker)
        @jupyter-server/resource-usage v0.6.0 enabled OK (python, jupyter-resource-usage)
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)
        @jupyterlab/git v0.34.0 enabled OK (python, jupyterlab-git)
        @pyviz/jupyterlab_pyviz v2.1.0 enabled OK (python, pyviz_comms)
        @ryantam626/jupyterlab_code_formatter v1.4.10 enabled OK (python, jupyterlab-code-formatter)
        @jlab-enhanced/favorites v3.0.1 enabled OK (python, jupyterlab-favorites)

govinda18 avatar May 05 '22 10:05 govinda18