# VTK/WASM and ImplicitPlaneWidget2 for a cross-section widget?

**URL:** <https://discourse.vtk.org/t/vtk-wasm-and-implicitplanewidget2-for-a-cross-section-widget/15252>\
**Category:** Development\
**Created:** [February 9, 2025, 10:15pm UTC](https://discourse.vtk.org/t/vtk-wasm-and-implicitplanewidget2-for-a-cross-section-widget/15252 "2025-02-09T22:15:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uv382](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/u/c89c15/32.png) [@uv382](https://discourse.vtk.org/u/uv382)\
**Post date:** [February 9, 2025, 10:15pm UTC](https://discourse.vtk.org/t/vtk-wasm-and-implicitplanewidget2-for-a-cross-section-widget/15252/1 "2025-02-09T22:15:57Z")

</div>

I have been studying the documentation [here](https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2) in an attempt to implement a cross-section widget in a VTK/WASM project. I have not been successful, even after copying and pasting the (Python) code directly from the example at that link into my project.

Specifically, the line `iren.Start()` fails in VTK/WASM.

I understand that `vtkRenderWindowInteractor.Start()` begins mouse interaction. However, since I’m using VTK/WASM, is there some other workflow I should be using to set up this widget? Is the example at that link still relevant with this technology?

Is there more documentation on how to enable a cross-section widget with VTK/WASM? If not, could a small code example be shared here? Thanks.

The following screenshot is as far as I’ve gotten in VTK/WASM with `ImplicitPlaneWidget2`. I had to comment out the `iren.Start()` line for it to work. As you can see, there is no actual “widget”, but rather just a 2D plane that has cut a sphere mesh in half:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e97cccbc7746d9cc7ab5bc39f3d3567cb99464e8.png)

---

<div class="post-metadata">

**Author:** ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)\
**Post date:** [February 9, 2025, 11:11pm UTC](https://discourse.vtk.org/t/vtk-wasm-and-implicitplanewidget2-for-a-cross-section-widget/15252/2 "2025-02-09T23:11:13Z")

</div>

Hi @uv382!

Noting here for the wider audience that @uv382 is using VTK.wasm through [trame-vtklocal](https://github.com/Kitware/trame-vtklocal/tree/master) package.

When incorporating widgets in such projects, they require special handling in server-side to properly (de)serialize across the boundary between python and WASM land.

The solution for your issue is to manually register the widgets with the scene manager. Otherwise, the widget is not visible to the marshalling layer. This explains why the widget disappears in your web client.

I suggest studying the [trame-vtklocal/examples/vtk/widgets\_plane.py](https://github.com/Kitware/trame-vtklocal/blob/master/examples/vtk/widgets_plane.py) and, the other `widgets_*` files in there.

fyi, @Sebastien_Jourdain
