-
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
The serialization issue is caused by setting a numpy object onto the state. If you convert the result to a Python float it will be fine. |
Beta Was this translation helpful? Give feedback.
-
The other issue is that you are editing a nested variable in the slider which means you are losing the reactivity client side unless you mark |
Beta Was this translation helpful? Give feedback.
-
v2.VSlider(
v_model=(f"params['{key}']",),
change="flushState('params')",
) |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! Converting the NumPy scalar to a Python float worked and adding |
Beta Was this translation helpful? Give feedback.
-
Just one more question on this, sorry. Given that So basically are there commands equivalent to I've tried |
Beta Was this translation helpful? Give feedback.
-
@state.change("params")
def params_react(params, **kwargs):
state.output["c"] = model(params)
state.dirty("output") # https://trame.readthedocs.io/en/latest/core.state.html#trame_server.state.State.dirty
...
...
# display updated values in output dictionary (doesn't work)
v2.VTextField(
value=("output['c']",),
readonly=True,
... |
Beta Was this translation helpful? Give feedback.
-
Hi @jourdain, one more quick follow-up question, about using If I am dealing with numbers that are very large (as opposed to the For instance, I would like the number to be displayed as Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Thanks a lot! Converting the NumPy scalar to a Python float worked and adding
change="flushState('params')"
to theVSlider
andVTextField
elements fixed the reactivity issue.