Skip to content

Instantly share code, notes, and snippets.

@cfbastarz
Last active February 8, 2023 21:43
Show Gist options
  • Save cfbastarz/b12aa8ddf293c264579f0ed1c1c996cf to your computer and use it in GitHub Desktop.
Save cfbastarz/b12aa8ddf293c264579f0ed1c1c996cf to your computer and use it in GitHub Desktop.
Print string from dropdown menu items (Holoviews Panel)
# To be used in a Jupyter notebook
import panel as pn
pn.extension()
variable_list = ['var1', 'var2', 'var3']
def get_val(variable):
return variable
variable = pn.widgets.Select(options=variable_list)
panel = pn.pane.Str()
@pn.depends(variable.param.value, watch=True)
def update_pane(variable):
panel.object = get_val(variable)
update_pane(variable.value)
pn.Row(
pn.Row(variable),
panel,
)#.servable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment