# Interactive plot with ipywidgets and pyvista trame hangs after interaction

**URL:** <https://discourse.jupyter.org/t/interactive-plot-with-ipywidgets-and-pyvista-trame-hangs-after-interaction/36711>\
**Category:** Widgets\
**Tags:** how-to, help-wanted\
**Created:** [July 13, 2025, 1:17pm UTC](https://discourse.jupyter.org/t/interactive-plot-with-ipywidgets-and-pyvista-trame-hangs-after-interaction/36711 "2025-07-13T13:17:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steffen](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@steffen](https://discourse.jupyter.org/u/steffen)\
**Post date:** [July 13, 2025, 1:17pm UTC](https://discourse.jupyter.org/t/interactive-plot-with-ipywidgets-and-pyvista-trame-hangs-after-interaction/36711/1 "2025-07-13T13:17:40Z")

</div>

After first interaction with an interactive Pyvista Trame plot, Jupyterlab hangs . The kernel status stays ‘busy’.  
In the examle below, I tried to choose the plot with ipywidget checkboxes. After running the cell, the the saddle is shown in a trame plot. But after the first click to the ‘red’ checkbox the notebook freezes.

Did I miss something?

```py
import ipywidgets as widgets
import pyvista as pv

pv.set_jupyter_backend('trame')

dataset = pv.examples.download_saddle_surface()

red_check_box = widgets.Checkbox(False, description="red")
green_check_box = widgets.Checkbox(False, description="green")
ui = widgets.HBox([red_check_box, green_check_box])

def draw_saddle(red, green):
    print(f"{red=}, {green=}")
    if red:
        dataset.plot(color='red') # plot() returns Plotter.show()
    elif green:
        dataset.plot(color='green')
    else:
        dataset.plot(color='grey')

out = widgets.interactive_output(
    draw_saddle,
    {
        'red': red_check_box,
        'green': green_check_box
    },
)

display(ui, out)

```

Jupyterlab Version 4.4.4  
pyvista version ‘0.45.2’  
ipywidgets 5.0.15

---

<div class="post-metadata">

**Author:** ![nasrin\_begum\_pathan](https://avatars.discourse-cdn.com/v4/letter/n/fbc32d/32.png) [@nasrin\_begum\_pathan](https://discourse.jupyter.org/u/nasrin_begum_pathan)\
**Post date:** [July 13, 2025, 4:22pm UTC](https://discourse.jupyter.org/t/interactive-plot-with-ipywidgets-and-pyvista-trame-hangs-after-interaction/36711/2 "2025-07-13T16:22:18Z")

</div>

[https://www.youtube.com/watch?v=HDxn8rcPc1Q](https://www.youtube.com/watch?v=HDxn8rcPc1Q) code works just right for me.

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [July 13, 2025, 5:13pm UTC](https://discourse.jupyter.org/t/interactive-plot-with-ipywidgets-and-pyvista-trame-hangs-after-interaction/36711/3 "2025-07-13T17:13:52Z")

</div>

Given what nasrin says, I’d encourage you to restart everything on your machine, including the machine itself and do a hard fresh of the browser page where you are running this `.ipynb` file. The communication can sometimes not happen if all the connections aren’t set up properly. And getting the browser to use the right code often requires clearing things out a bit.
