I have a function(heavy computation) that depends from 4 Widgets(IntSlider, FloatSlider, FloatInput, FloatSlider).
For each widget I add watcher to this function.
But now, I have a button that should set them to some global values. So I need to change all widgets values at once and call function only once.
So I need update all widgets value without executing watchers and then execute my function.
Do you have any suggestions how to implement it?
import panel as pn
p1 = param.Number(default=0, bounds=(0,10))
p2 = param.Number(default=0, bounds=(0,10))
reset = param.Event()
counter = param.Integer(default=0)
@param.depends("p1", "p2", watch=True)
self.counter += 1
self.p1 = 0
self.p2 = 0
In the example you posted you could also more simply just do:
However I think @Illia was not necessarily using a param based approach so it would be great to know what exactly you are trying before I suggest something.