Trying to notify users when a “parameter” is externally updated visually by changing the widgets background.
Not a problem if the widget is directly created, but couldn’t find a way for parameterized classes, example below.
I did try widget = pn.Param(pc).widget('param_string')
which gives you a widget linked to the parameter value
, but it’s a different widget, not the one in the displayed pane.
Is there a recommended way ?
Kind regards,
Oz
import param
import panel as pn
pn.extension()
class DemoParameterizedClass(param.Parameterized):
param_string = param.String(default="str", doc="A string")
def __init__(self, *param, **params):
super().__init__(*param, **params)
self.text_widget = pn.widgets.TextInput(name='Text Input', placeholder='Enter a string here...')
pc = DemoParameterizedClass()
pane = pn.Column(pc.param, pc.text_widget)
pc.text_widget.background = 'green'
###
# How to DYNAMICALLY change the background of the widget representing param_string parameter ??
##
pane