ALL software version info
https://gist.github.com/tomascsantos/458bcabe14efa26e46f03d5f4544e603
Description of expected behavior and the observed behavior
From: https://pyviz-dev.github.io/param/user_guide/Parameter_Types.html#selectors
Otherwise, the objects should be provided as a name:value dictionary, where the string name will be stored for use in such a UI, but is not otherwise accessed by Param. The values from setting and getting the parameter are always the actual underlying object, not the string names. Because the string name will need to be looked up from the value if this parameter is used in a UI, all objects need to be hashable via the param.hashable() function, which accepts Python literals plus list and dictionary types (treating them like tuples).
I expect that if I set the objects parameter of a ListSelector to be a dictionary then it will use the value instead of the name when selecting the via user input. Instead I notice this behavior to be true only if the dictionary is supplied during instantiation, but does not work if supplied later.
Complete, minimal, self-contained example code that reproduces the issue
import param
import panel as pn
pn.extension()
class MVP(param.Parameterized):
my_list = param.ListSelector(objects={'Hello': 'hi', 'World':'w'})
@param.depends('my_list', watch=True)
def _view_selected(self):
"""View the selected items in my list"""
print('selected', self.my_list)
m = MVP()
pn.Column(m)
# This has expected behavior
class MVP_TWO(param.Parameterized):
my_list = param.ListSelector(objects={'test': 'me'})
def __init__(self):
super().__init__()
self.param.my_list.objects = {'Hello': 'hi', 'World': 'w'}
@param.depends('my_list', watch=True)
def _view_selected(self):
"""View the selected items in my list"""
print('selected', self.my_list)
m2 = MVP_TWO()
pn.Column(m2)
# This does not work as expected
Screenshots or screencasts of the bug in action
(Notice in the second example the printed values are the name not the values

ALL software version info
https://gist.github.com/tomascsantos/458bcabe14efa26e46f03d5f4544e603
Description of expected behavior and the observed behavior
From: https://pyviz-dev.github.io/param/user_guide/Parameter_Types.html#selectors
I expect that if I set the
objectsparameter of aListSelectorto be a dictionary then it will use thevalueinstead of the name when selecting the via user input. Instead I notice this behavior to be true only if the dictionary is supplied during instantiation, but does not work if supplied later.Complete, minimal, self-contained example code that reproduces the issue
Screenshots or screencasts of the bug in action
(Notice in the second example the printed values are the
namenot thevalues