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

ipywidget sliders disappear on use #33

Open
lukejanicke opened this issue Mar 29, 2020 · 5 comments
Open

ipywidget sliders disappear on use #33

lukejanicke opened this issue Mar 29, 2020 · 5 comments

Comments

@lukejanicke
Copy link

Application or Package Used

nteract desktop

Describe the bug

ipywidget sliders dissapear when they are used.

To Reproduce

import ipywidgets as widgets
from IPython.display import display

a = widgets.IntSlider(description='a')
b = widgets.IntSlider(description='b')
c = widgets.IntSlider(description='c')

def f(a, b, c):
    print('{}*{}*{}={}'.format(a, b, c, a*b*c))

out = widgets.interactive_output(f, {'a': a, 'b': b, 'c': c})

display(out)
display(a, b, c)

Expected behavior

The output should update to show the product of the three slider numbers.

Screenshots
Screen Shot 2020-03-29 at 11 17 39 a m
Screen Shot 2020-03-29 at 11 17 43 a m

Desktop

macOS Catalina 10.15.4
nteract 0.22.0
Python 3.7.7
ipywidgets 7.5.1

Additional context

I am trying to reproduce the example here from ipywidgets documentation. The documentation example is not for nteract, but every modified version with display also fails to show the sliders.

@captainsafia
Copy link
Member

Thanks for opening this issue, @lukejanicke! I was able to reproduce the issue that you've referenced here.

I think the issue is a bug in how we currently interpret clear_output messages that come back from the kernel. When you move the slides above, the following message is sent from the kernel to the client over the comms API.

{
  "header": {
    "msg_id": "f6bb6db1-1795936ade2303a1a4b4481d",
    "msg_type": "clear_output",
    "username": "captainsafia",
    "session": "a60291c9-81e874f8d5abc595a342cc7a",
    "date": "2020-03-29T18:16:02.315142Z",
    "version": "5.3"
  },
  "msg_id": "f6bb6db1-1795936ade2303a1a4b4481d",
  "msg_type": "clear_output",
  "parent_header": {
    "session": "934765ce-79c0-4af5-af08-e6a1cbab9e7f",
    "msg_id": "a8dab038-b92f-4194-bf57-343514bed71c",
    "date": "2020-03-29T18:16:02.309000Z",
    "version": "5.2",
    "username": "nteract",
    "msg_type": "comm_msg"
  },
  "metadata": {},
  "content": {
    "wait": true
  },
  "buffers": [],
  "channel": "iopub"
}

This message is supposed to clear the output that displays 0*0*0=0 so that it can be updated with the newest values from the sliders. Instead, it clears out all the outputs of the cell.

We'll have to investigate how to only clear out the intended output instead of all outputs in the cell when we receive the clear_output message over the comms.

We are releasing the March release tomorrow so this likely won't happen by then but tagging this for the April release.

@geffenacademyatucla
Copy link

This is still an issue as of v0.25.

I am able to run the example from the ipywidgets Getting Started:

from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets

def f(x):
    return x

interact(f, x=10);

However, the above code in nteract v0.25, Mac OS 10.14.6 only outputs 10.

If this could be fixed that would be awesome and my students (and I!) would really appreciate it.

@jacobo-diaz
Copy link

I agree with all the above. This would be great for my lectures in the next semester.

@captainsafia
Copy link
Member

Moving this to the outputs repo where the ipywidgets transform now lives.

@captainsafia captainsafia transferred this issue from nteract/nteract Oct 27, 2020
@generic-github-user
Copy link

I just tested this on v0.28.0 and am having the same issue.

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

5 participants