minimal example of something I’ve tried:
choices_w1 = pn.widgets.MultiSelect(name='Choices',options=[1,2,3,4,5])
choices_w2 = pn.widgets.MultiSelect(name='Choices',options=[1,2,3,4,5])
# The following doesn't work
drx = pn.rx({1:choices_w1.param.value, 2:choices_w2.param.value, ...}) # try to bind into a reactive dictionary
pn.ReactiveExpr(drx) #when choices_w1,2 change, this view doesn't change. it also shows the default value of the multiselects instead of the actually selected values
# kind of works, doesn't seem like good practice, though
def collect(*args):
return [*args]
collected = pn.bind(collect, choices_w1, choices_w2)
pn.panel(collected)
# updates for now
def collect(**kwargs):
return dict(**kwargs)
collected = pn.bind(collect, w0=choices_w, w1=choices_w1, w2=choices_w2)
pn.panel(collected)
# how I'm driving subsequent actions
def pipeline(collected):
tmp = {kw:val for kw,val in collected.items()}
s = pd.Series(tmp)
return s
evaluated = pn.bind(pipeline,collected)
evaluated # renders ok
Again, I am hoping to have a reactive dictionary drive subsequent changes, instead of having to track and explicitly enumerate the 30+ multiselect widgets.
Ultimately, my subsequent code is uses a pipeline of calculations that does not know about param and is used in other scripts, so hoping that there is something I can do to turn the widgets into a standard data structure – is the this design pattern I’m using ok, where I take a reactive object, process it into a normal pandas object, process it, then continue passing it on?
Thanks!