CustomExample with ObjectSelector does not update value

Hello,
Changing the custom exemple in the doc to an ObjectSelector parameter is not updating the value. select_string is returning a value. But when change the widget to CheckBoxGroup the value is None.

Is it related to this Dynamically update ObjectSelector dropdown ?

How can I change that ? i don’t understand the proper way to do it.

class CustomExample(param.Parameterized):
    """An example Parameterized class"""
    select_string = param.ObjectSelector(objects=["red", "yellow", "green"])
    
    @param.depends('select_string')
    def view(self):
        return self.select_string
    
custo = CustomExample()
pn.Row(pn.Param(custo.param,  widgets={
    'select_string': pn.widgets.CheckBoxGroup,
}
), custo.view)

Thanks

You should be seeing an error when doing this, so something appears to be wrong there but your real issue is that you want the pn.widgets.RadioBoxGroup widget not the pn.widgets.CheckBoxGroup. The RadioBoxGroup allows selecting only one item while the CheckBoxGroup returns a list of selected items, which does not work with an ObjectSelector. If you do want to select multiple you can use the param.ListSelector with the CheckBoxGroup widget.

1 Like