J-M
J-M
SSolara
Created by J-M on 5/8/2024 in #questions-issues
Reusing ipywidget composite UI in solara
THanks @MaartenBreddels and apologies for the belated reply. if by global widget you mean a static variable (class variable) I don't think so. I worked around this, perhaps for the better anyway. I'll see if I can make the time this month to write one or more blog posts on solara and give links.
6 replies
SSolara
Created by J-M on 5/8/2024 in #questions-issues
Reusing ipywidget composite UI in solara
Thank you @Iisakki Rotko . I think I can get by trying to use every ipywidgets one by one, using .element. I do not understand the widget lifecycle (python and JS sides) enough to understand why it is reported as closed. I thought the use of a global variable _simui = ui to hold an indirect reference to all ipywidget instances via ui would prevent garbage collection (if this is a synonym of "closed") and keep widgets "alive".
6 replies
SSolara
Created by J-M on 5/8/2024 in #questions-issues
Reusing ipywidget composite UI in solara
I am doing something wrong using display on a ipw VBox, perhaps. Any insight would be welcome.
Traceback (most recent call last):
"/v/lib/python3.9/site-packages/reacton/core.py", line 1707, in _render
root_element = el.component.f(*el.args, **el.kwargs)
"//app/pages/__init__.py", line 208, in ParamSelector
build_param_ui(station_id)
# snipping lines
fs=ipw.FloatSlider(
"/ipywidgets/widgets/widget_float.py", line 26, in __init__
super().__init__(**kwargs)
"/ipywidgets/widgets/widget_description.py", line 35, in __init__
super().__init__(*args, **kwargs)
"/ipywidgets/widgets/widget.py", line 506, in __init__
self.open()
"/ipywidgets/widgets/widget.py", line 525, in open
state, buffer_paths, buffers = _remove_buffers(self.get_state())
"/ipywidgets/widgets/widget.py", line 615, in get_state
value = to_json(getattr(self, k), self)
"/ipywidgets/widgets/widget.py", line 54, in _widget_to_json
return "IPY_MODEL_" + x.model_id
"/solara/server/patch.py", line 527, in model_id_debug
raise RuntimeError(f"Widget {type(self)} has been closed, the stacktrace when the widget was closed is:\n{closed_stack[id(self)]}")
RuntimeError: Widget <class 'ipywidgets.widgets.widget_layout.Layout'> has been closed, the stacktrace when the widget was closed is:
"/v/bin/solara", line 8, in <module>
sys.exit(main())
Traceback (most recent call last):
"/v/lib/python3.9/site-packages/reacton/core.py", line 1707, in _render
root_element = el.component.f(*el.args, **el.kwargs)
"//app/pages/__init__.py", line 208, in ParamSelector
build_param_ui(station_id)
# snipping lines
fs=ipw.FloatSlider(
"/ipywidgets/widgets/widget_float.py", line 26, in __init__
super().__init__(**kwargs)
"/ipywidgets/widgets/widget_description.py", line 35, in __init__
super().__init__(*args, **kwargs)
"/ipywidgets/widgets/widget.py", line 506, in __init__
self.open()
"/ipywidgets/widgets/widget.py", line 525, in open
state, buffer_paths, buffers = _remove_buffers(self.get_state())
"/ipywidgets/widgets/widget.py", line 615, in get_state
value = to_json(getattr(self, k), self)
"/ipywidgets/widgets/widget.py", line 54, in _widget_to_json
return "IPY_MODEL_" + x.model_id
"/solara/server/patch.py", line 527, in model_id_debug
raise RuntimeError(f"Widget {type(self)} has been closed, the stacktrace when the widget was closed is:\n{closed_stack[id(self)]}")
RuntimeError: Widget <class 'ipywidgets.widgets.widget_layout.Layout'> has been closed, the stacktrace when the widget was closed is:
"/v/bin/solara", line 8, in <module>
sys.exit(main())
6 replies