How to use Buttons from Bokeh widgets interactive

bonian
Level 2
How to use Buttons from Bokeh widgets interactive
Hello,

I m trying to implement a dropdown button into my bokeh script. I have a map with dots with labels. Now i want to change the displayed labels according to the selection in the dropdown.

I m getting the button displayed, but changes are not commited. My guess is that the bokeh server is exiting after running the skript.

According to bokeh i would have to use "show" or bokeh serve command in command line and use the session object in my code.
Both possibilitys dont work in dataiku webapp.

What can i do?

Here is what i was using:

#dropdown

menu = [("jetzt", "0"),("+1 Stunden", "1"), ("+2 Stunden", "2"), ("+3 Stunden", "3"),("+4 Stunden", "4"),("+5 Stunden", "5")]
dropdown = Dropdown(label="Uhrzeit auswรคhlen", button_type="warning", menu=menu)

def function_to_call(new):
print dropdown.value
print new
#extract_df(dropdown.value)

dropdown.on_click(function_to_call)

#show(widgetbox(dropdown))
#call to show() ignored when running scripts with the 'bokeh' command.

curdoc().add_root(row(widgetbox(dropdown), width=800))
0 Kudos
0 Replies

Labels

?
Labels (3)
A banner prompting to get Dataiku