How to change/update the bounds of a param.Range object


I am building a small dashboard app using Panels and Params. For one of its plots I need to update the bounds (limits of the UI’s slider) of a param.range object accordingly to another param object value. I already can change the range values accordingly to this other param object however I cannot change the bounds of this range object.

As a example I have a kind object and a slider object:

class C(param.parametrized):
   kind = param.Selector(default="temperature", objects=["temperature", "pression","elevation"]
  slider_param = param.Range(default(0,1), bounds=(0,1))
def update_slider(self):
    minmax = self._getMinAndMax(kind)
    slider_param = minmax
    # Is there a way to change the bounds range of this slider_param object ?
    # to make the slider pretty


Hello I have found a way to do. But I am not sure if it is recommended or a good way to do that:

obj = C()
obj.params()["slider_param"].bounds = new_bounds
1 Like

It is one way to do it @dashAllTheThings :+1:

Alternatively you can use obj.param.slider_param.bounds = new_bounds. I’ve seen that used more.

Update: changed .params to param.

It’s actually without the s:

obj.param.slider_param.bounds = new_bounds

that is equivalent to:

obj.param['slider_param'].bounds = new_bounds
1 Like