Can I add buttons or sliders that call my Python script?
Not in the native Viewer. The native Viewer has no user-defined widgets (buttons, sliders, text fields), and it does not send events (such as selection changes) back to a Python logging script. See missing features.
Here is what you can do instead.
Callbacks in the web Viewer and in notebooks
We support registering callbacks to Viewer events, such as selection and time changes, in these environments:
- Web browsers, through our JS package
- Jupyter notebooks, through our Notebook API
In both cases, you can build your own widgets in the host page or notebook (for example with ipywidgets), and use them to control the Viewer.
Callbacks in Rust
For users extending the Viewer through the Rust re_viewer crate, there are two options:
- Use
StartupOptions.on_eventto register the same events available on the web and in Jupyter. Theviewer_callbacksexample shows how. - Extend the UI to add your own widgets using
egui, and fire completely custom events. Thecustom_callbackexample shows how.
Drive the Viewer from Python
The experimental rerun.experimental.ViewerClient connects to a running Viewer and controls it from Python.
It can open and close recordings, move the time cursor, start and stop playback, read and replace the blueprint, and take screenshots.
It can also read a snapshot of the Viewer state (open recordings, the time cursor, and the views), but not the current selection.
See Control playback and drive the Viewer from code.