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

interact-based widgets do not render #8

Open
captainsafia opened this issue Oct 28, 2019 · 8 comments
Open

interact-based widgets do not render #8

captainsafia opened this issue Oct 28, 2019 · 8 comments
Assignees

Comments

@captainsafia
Copy link
Member

In the Using Interact example notebook, the horizontal slider does not render when the interact code is executed.

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);
@miduncan miduncan self-assigned this Nov 5, 2019
@miduncan
Copy link

miduncan commented Nov 5, 2019

I did some investigating on this, and it is caused by the model being different than the other models we deal with. Instead of having the information we normally expect, it has a list of child models. I'll try to get a fix for this tomorrow.

@captainsafia
Copy link
Member Author

If that’s the case, then it is probably also related to the issue around Boxes and Accordions not rendered correctly because they are child_views.

Let us know what you find out.

@miduncan
Copy link

miduncan commented Nov 5, 2019

nteract/nteract#4640 for sake of tracking. I'll investigate both

@miduncan
Copy link

miduncan commented Nov 6, 2019

I was able to dig deeper into this, and it may be a tricky one to fix. It basically follows these steps:

  1. Kernel sends a message for a new model, "model_1", with a state like this (notice the empty children):
state: {
  box_style: ""
  children: []
  layout: "IPY_MODEL_38e17f2743414a148d7ea0856a910eec"
  _dom_classes: ["widget-interact"]
  _model_module: "@jupyter-widgets/controls"
  _model_module_version: "1.5.0"
  _model_name: "VBoxModel"
  _view_count: null
  _view_module: "@jupyter-widgets/controls"
  _view_module_version: "1.5.0"
  _view_name: "VBoxView"
}
  1. After some time, kernel sends an "update" message to "model_1"
data: {
  buffer_paths: []
  method: "update"
  state: {
    children: ["IPY_MODEL_model_2",  IPY_MODEL_model_3"]
  }
}
  1. Kernel sends the "application/vnd.jupyter.widget-view+json" message we direct to WidgetDisplay
application/vnd.jupyter.widget-view+json: {
  model_id: "model_1"
  version_major: 2
  version_minor: 0
}
  1. When widget looks up the "model_1", it gets the data from step 2. The information in step 1 is lost
  2. Error is thrown because no view information is provided to create_widget

@miduncan
Copy link

miduncan commented Nov 6, 2019

I'm guessing this is the same issue with Accordion and Tabs, as the model state given to them also only has children. No view information.

@miduncan miduncan changed the title Slider via ipywidgets interact does not render Interact and Accordion widgets do not render/load Nov 6, 2019
@captainsafia captainsafia changed the title Interact and Accordion widgets do not render/load interact-based widgets do not render Nov 7, 2019
@miduncan
Copy link

miduncan commented Nov 8, 2019

Rendering issues cause by #3

@xinyi-joffre
Copy link

@captainsafia , we are also running into issues with nteract and interact ipywidgets in our most recent project. Are there any plans to support this in near future?

@vveralag
Copy link

vveralag commented Aug 1, 2023

Same issue with an asynchronous slider response, is there a list of widgets that can be used with an asynchronous response?

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

4 participants