Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jpradov opened this issue Jan 3, 2023 · 1 comment
Open

Comments

@jpradov
Copy link

jpradov commented Jan 3, 2023

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

@dou-du
Copy link
Contributor

dou-du commented May 9, 2023

Thanks for reporting this! This is a interesting issue. Actually, I know why this happen. But it is diffult to solve. I need to think about it and come back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants