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

Output messages sent from widgets not displayed in cell output #9503

Closed
AoifeHughes opened this issue Mar 28, 2022 · 2 comments · Fixed by #10327
Closed

Output messages sent from widgets not displayed in cell output #9503

AoifeHughes opened this issue Mar 28, 2022 · 2 comments · Fixed by #10327
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ipywidgets Rendering, loading, saving, anything to do with IPyWidgets verified Verification succeeded
Milestone

Comments

@AoifeHughes
Copy link

Hi,

My system:

Version: 1.65.2 (Universal)
Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
Date: 2022-03-10T14:33:49.188Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 21.1.0
~ python --version
Python 3.10.0
 ➜  ~ jupyter --version
Selected Jupyter core packages...
IPython          : 8.0.1
ipykernel        : 6.9.0
ipywidgets       : 7.7.0
jupyter_client   : 7.1.2
jupyter_core     : 4.9.1
jupyter_server   : not installed
jupyterlab       : not installed
nbclient         : 0.5.13
nbconvert        : 6.4.4
nbformat         : 5.2.0
notebook         : 6.4.10
qtconsole        : 5.2.2
traitlets        : 5.1.1

Similar issues:

Code used:

from IPython.display import display
from ipywidgets import widgets, interactive
button = widgets.Button(description="Run!")
def on_button_clicked(b):
    print('Clicked')
display(button)
button.on_click(on_button_clicked)

In Jupyter Web interface this works perfectly. In VScode it does nothing.

However, the example give here #3767 (comment) works just fine. So it seems that they only work with decorators?

I tested this using:

from IPython.display import display
from ipywidgets import widgets, interactive, interact
button = widgets.Button(description="Run!")
@interact(b=[0,1])
def on_button_clicked(b):
    if b ==1:
        print('Clicked')

This seemed to work fine. A bit of a hacky workaround, particularly as decorators don't seem to have a method for buttons...

@AoifeHughes AoifeHughes added the bug Issue identified by VS Code Team member as probable bug label Mar 28, 2022
@rchiodo rchiodo added info-needed Issue requires more information from poster and removed needs-triage labels Mar 28, 2022
@DonJayamanne
Copy link
Contributor

Thanks for filing this issue, I can replicate this at my end, Will try to dig into the issue and see whats causing this.

@DonJayamanne DonJayamanne added ipywidgets Rendering, loading, saving, anything to do with IPyWidgets and removed info-needed Issue requires more information from poster labels Mar 30, 2022
@DonJayamanne
Copy link
Contributor

DonJayamanne commented Mar 31, 2022

Took a while to figure out the issue, its a bug at our end.
Difficult to explain but here are some of the technical details, we need to:

  • Track the comm id associated with the widget displayed
  • When messages of type stream come back and found to be associated with the previous commid, we'll need to append these output to the corresponding cell output.

@DonJayamanne DonJayamanne removed their assignment Mar 31, 2022
@rchiodo rchiodo added this to the April 2022 milestone Mar 31, 2022
@rchiodo rchiodo modified the milestones: April 2022, May 2022 Apr 27, 2022
@DonJayamanne DonJayamanne self-assigned this May 24, 2022
@DonJayamanne DonJayamanne changed the title Widgets work in some scenarios but not others Output messages sent from widgets not displayed in cell output May 27, 2022
@rchiodo rchiodo modified the milestones: May 2022, June 2022 Jun 1, 2022
@connor4312 connor4312 added the verified Verification succeeded label Jun 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug ipywidgets Rendering, loading, saving, anything to do with IPyWidgets verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants