outputs icon indicating copy to clipboard operation
outputs copied to clipboard

ipywidget sliders disappear on use

Open lukejanicke opened this issue 5 years ago • 5 comments

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.

lukejanicke avatar Mar 29 '20 03:03 lukejanicke

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.

captainsafia avatar Mar 29 '20 23:03 captainsafia

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.

geffenacademyatucla avatar Sep 06 '20 21:09 geffenacademyatucla

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

jacobo-diaz avatar Oct 27 '20 09:10 jacobo-diaz

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

captainsafia avatar Oct 27 '20 20:10 captainsafia

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

generic-github-user avatar Jun 23 '21 13:06 generic-github-user