Comments (6)
Same for using marimo.ui.anywidget
.
from marimo.
To bring anywidget into marimo's reactive system, you'll need to wrap it in mo.ui.anywidget
m = MapWidget(map_options)
m.use_message_queue(False)
m.add_control(NavigationControl())
m.add_deck_layers([deck_grid_layer])
map = mo.ui.anywidget(m)
map
In order for the downstream cell's to re-render based off the reactive changes from w
, you'll need to pick the values off that instead of m
.
map.value["clicked"]
or you can force the dependency between cells by doing something like:
map.widget.clicked
We can look into making anywidget more tightly integrated without having to wrap marimo.ui.anywidget
from marimo.
Hi, yes I know and I first did it this way and w.value
works fine but I need it the other way round. I need to update the widget itself from Python, e. g. to update layer properties after it was initially rendered. In the example I provided I wanted to add a ScaleControl after the widget was rendered. This is done via Anywidget.send
method.
Maybe only model.on("change:my_value")
is supported?
from marimo.
Oh sorry - I read this fast and started with your re-production code, which didn't have .send
- but i see now, its from add_control(ScaleControl())
.
I can look into getting .send
working, but this feels like mutating state which usually does not play nicely in a reactive environment.
from marimo.
I can see the value of .send
in other contexts (button click or conditionals). We can look into supporting this, but as of now, we don't have any existing mechanism for python widgets to send data to their frontend counterpart after rendering (we do if they request it, as an RPC), but not a plain bi-directional connection.
from marimo.
I have a fix here: #1776
I added a test example to make sure this works. Since the adding the controls are not idempotent (you can add the same control multiple times), i put it behind a mo.ui.run_button()
from marimo.
Related Issues (20)
- marimo edit hangs HOT 5
- `mo.ui.table` for Pandas Dataframe do not work in HTML exports HOT 5
- Changing the position of a set of cells HOT 2
- add `packaging` to dependencies? HOT 2
- live documentation changes format while typing argument to function I'm looking at docs of
- Feedback when stale cell is queued (lazy executor) HOT 4
- Request to manually edit dependencies
- Callouts: a bug and a suggestion HOT 2
- Brush Transparency Issue in Chart Rendering HOT 9
- Dict comprehension with form leads to TypeError('cannot pickle '_thread.lock' object') HOT 1
- SyntaxError causes cell to lock up HOT 2
- Support stateless for multi container scaling and deployment
- A small bug and one shortcut gone (or two) HOT 6
- TOC in static export of the notebook HOT 4
- Add option to "copy as pathname" to files/folders on the file browser panel HOT 2
- Stale column previews in ui.table
- Slow tests causing CI failures again
- outputting dataframe with tons of columns crashed all marimo browser tabs HOT 2
- Tracebacks with long error messages are truncated on frontend
- displaying a polars dataframe with an array column spews error output HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marimo.