☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Text in div based on single selection widget

Community Support
p-himik
p-himik

Just change Div.text in your Python callback that reacts to the select’s value change. Note that it will work only if you’re using bokeh serve. If you aren’t, then there will have to be some JS, but it will be just 1-2 lines.

⌁   Link to post
grzegorz.malinowski
grzegorz.malinowski

Thanks Eugene,
This is what I’ve manage to invent. Unfortunately it doesn’t work. Can you please point out what and how should be corrected?

select_biplot = Select(title = 'Select Biplot', value = 'SYM', options = ['SYM', 'COV', 'JK'])
SYM = """SYM Your For this example"""
COV = """COV Your For this example"""
JK = """JK Your For this example"""

div_biplot = Paragraph(text=SYM, width=240, css_classes=['div_biplot'])
menu_biplot = Column(select_biplot, div_biplot, name='menu_biplot', width=250)

def biplot_callback(attrname, old, new):
    if select_biplot.value == 'COV':
        Paragraph.text=COV
    elif select_biplot.value == 'JK':
        Paragraph.text=JK
    else:
        Paragraph.text=SYM
select_biplot.on_change('value', biplot_callback)

curdoc().add_root(menu_biplot)
⌁   Link to post
_jm
_jm

@grzegorz.malinowski

Your callback is modifying the bokeh core model Paragraph, but you need to operate on your specific model, div_biplot.

Your callback should be something like the following.

def biplot_callback(attrname, old, new):
    if new == 'COV':
        div_biplot.text=COV
    elif new == 'JK':
        div_biplot.text=JK
    else:
        div_biplot.text=SYM
⌁   Link to post

End of archived discussion · Replies are disabled