Skip to content

Rendering ipywidgets in Quarto #12

@nicole-brewer

Description

@nicole-brewer

TLDR: I don't think it's possible to use server-side widgets using Jupyter Notebooks and Quarto. It may be possible to render basic widgets in a .qmd document instead, though there is confusion about which Jupyter widgets actually will work.

In the documentation, it appears that this should be possible

"Jupyter Widgets and htmlwidgets ... run entirely client-side so can be deployed within normal static HTML documents.

There are several issues that suggest that this documentation is somewhat misleading.

In quarto-dev/quarto-cli#6496, some people say that there is confusion because some, but not all of the client-side widgets seem to work. That point aside, the following working example was proposed:

---
format: html
---

```{python}
import ipywidgets as widgets
widgets.IntSlider()
```

and then calling the command quarto render example.qmd and opening the resulting file, example.html, in a browser tab.

This work for me as well when I put that code in a quarto markdown document (.qmd) only.

Screenshot 2024-06-19 at 7 11 22 PM

However, when I try the same example using a Jupyter Notebook, the code appears just the same, but the javascript widget doesn't appear.

Screenshot 2024-06-19 at 7 15 46 PM

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