Skip to content

multiple calls to IPython.display() renders CodeInput in wrong cell #15

@jpradov

Description

@jpradov

Hello everyone,

When we display(codeinput) multiple times, the content of the WidgetCodeInput is rendered only on the output of the first display() call, and the following calls yield blank boxes.
image

The expected behaviour would be to have two separate renderings of the same Widget connected to the same backend View, according to the ipywidgets doc. This happens without problem for standard ipywidget Widgets.

My impression after reading this bit about WidgetModels is that the Typescript back-end object has trouble identifying which one of the WidgetView is trying to render the WidgetModel.

I am using Safari/Firefox and
widget_code_input : 3.5.5
IPython : 8.3.0
ipykernel : 6.9.1
ipywidgets : 8.0.3
jupyter_client : 7.2.2
jupyter_core : 4.11.1
jupyter_server : 1.18.1
jupyterlab : 3.4.8
nbclient : 0.5.13
nbconvert : 6.4.4
nbformat : 5.3.0
notebook : 6.4.11
qtconsole : 5.3.1
traitlets : 5.3.0
ipywidgets : 8.0.3

Code to reproduce :

#first cell

from widget_code_input import WidgetCodeInput

codeinput = WidgetCodeInput(
        function_name="foo", 
        function_parameters="",
        docstring=""" """,
        function_body="""

return True
"""
        )

display(codeinput)
# second cell 
display(codeinput)

Thank you very much for the help,

João

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions