Is there a way to apply processing to param.value?

Something like:

import panel as pn

def repeat_capital(value):
    value = value + value.upper()

a = pn.widgets.Select(options=['a', 'b'])
v = a.param.value.apply(capitalize)

For Select, you could use a dictionary. The dictionary keys are displayed, the values hold the value.

displaylist = ['a', 'b']
valuelist = [x.capitalize() for x in displaylist]
w = pn.widgets.Select(options=dict(zip(displaylist,valuelist)))
w

image

w.value

ā€˜Aā€™

2 Likes