Hello,
I’m new to panel and most likely have a misunderstanding. Hope somebody can help me.
I have a function with an argument and I want to link that argument to a slider.
Here is a very simplified example:
def my_func(argument):
# complex operations based on the argument, not shown here
print(argument*5)
return
func_inst = my_func(argument=5)
arg_slider = pn.widgets.IntSlider(start=0,end=19,value=10)
arg_slider.link(my_func,value='argument')
pn.Row(arg_slider,func_inst)
This shows the slider and the initial result (from argument 5), but when I move the slider, the function is not recalculated.
I know that there are different ways to do this, e.g. via “interact”. For the example I have, interactive causes a few headaches, as I have multiple sliders and need to put them in different places on the panel.
I am not sure if “link” really supports a handling as I’m looking for, i.e. if it can link a slider and a function-argument. Please just say if that is not possible.
Thanks for your help!
Cheers,
Georg