Hi everyone,
We are trying to use panel.widgets.JSONEditor
as the frontend to view and edit a configuration dictionary. However, it does not seem we can create the widget using the from_param
method as the other widgets.
For example, the following code
class JSONEditorDemo(param.Parameterized):
config = param.Dict(default={"data": 1}, doc="config")
def panel(self):
return pn.widgets.JSONEditor.from_param(self.config)
demo = JSONEditorDemo()
demo.panel()
will result in the following error messagaes:
File ~/micromamba/envs/imars3d_dev/lib/python3.10/site-packages/panel/widgets/base.py:88, in Widget.from_param(cls, parameter, **params)
71 """
72 Construct a widget from a Parameter and link the two
73 bi-directionally.
(...)
84 Widget instance linked to the supplied parameter
85 """
86 from ..param import Param
87 layout = Param(
---> 88 parameter, widgets={parameter.name: dict(type=cls, **params)},
89 display_threshold=-math.inf
90 )
91 return layout[0]
AttributeError: 'dict' object has no attribute 'name'
Is there a way to bypass this issue?