Skip to content

Document ipywidgets #239

Description

@Tom-van-Woudenberg

I now have gone in depth into the problem with live code and matplotlib widgets' sliders. As you suspected, multiple interactive sliders will not work together on the same page. This is also the case in a standard jupyter notebook.
The main reason is that multiple sliders unless kept referenced, through being stored in a Python list or a weaker reference such as storing each individual slider in its own separate variable, will be garbage collected by Python. This means only the last loaded slider, as we saw, is working upon running all code cells. However, referencing will not solve the problem in the case of Jupyter Books, as opposed to Jupyter Notebooks, since it seems that even if the sliders are kept alive, the figure will not update or just break upon moving the sliders.
So, the solution is either to stick to ipywidgets or javascript iframes, or as a last case scenario to use plotly. This, of course, if you intend to have multiple interactive figures on the same page.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions