Access and Set Widget Values#
This guide addresses how to access and set widget values.
In addition to other parameters that govern widget behavior and appearance, Widget objects have a value
parameter that can be used to access the current value state.
Let’s first create a TextInput
widget:
import panel as pn
pn.extension() # for notebook
widget = pn.widgets.TextInput(name='A widget', value='A string')
widget
Now we can programmatically access its value:
widget.value
We can also use this value parameter to set the widget value:
widget.value = '3'