-
Notifications
You must be signed in to change notification settings - Fork 6
Using @render_widget
with non-UI ipywidgets
#133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @kylebarron, thanks for this issue! I hadn't really anticipated wanting to use Also, to get your examples working, I had to change |
@render_widget
with non-UI ipywidgets
Awesome, thanks! Looking forward to trying this out!
I was using the local |
Description
I develop a Jupyter Widget called lonboard for geospatial data visualization. It uses the same underlying JS library as pydeck but is 10-50x faster/more capable because it uses efficient binary data serialization instead of JSON and because it can copy binary buffers directly to the GPU.
I'm trying to add an example in the lonboard documentation of how to use with shiny, but it's unclear how to handle reactivity of multiple widgets, where only one is intended to be rendered.
The architecture of lonboard is that there's one top-level
Map
widget but a variety ofLayer
classes to render points, lines, polygons etc. Each of theseLayer
classes is themselves a Widget so that their attributes can be reactive. But only theMap
is associated with a JS view.I'd like to have each widget as its own reactive element.
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
What I Did
This first example worked but is a bit clunky
Screen.Recording.2024-02-06.at.5.13.27.PM.mov
Setting
map.widget.layers[0].get_fill_color
is pretty clunky because you're accessing the layer widget through the Map object. Instead, the usual suggestion in the docs in Jupyter is to editlayer.get_fill_color
directly. So what I was hoping would work is the following:Here there are two widgets, the
layer
and themap
. This is simpler becauseset_fill_color
is reactive onto the layer instead of the map. But nothing renders on screen. Is there a different decorator I should be using instead ofrender_widget
ondef layer
?The text was updated successfully, but these errors were encountered: