I know, I can display images with Div in bokeh as per this example:
How to display static images in Bokeh using Div
But would it be possible to alter the image shown based on some input. So for example, I have three pictures in an images folder and a dropdown select menu with bokeh. Would it be possible to alter the Div based on whatever the user has selected?
I am deploying this with bokeh server not just static html.
I now have this:
def maphandler(attr, old, new):
div.text = new
div = Div(text="<img src='images/map2016.png'>")
menu = [("2016", "<img src='images/map2016.png'>"),
("2017", "<img src='images/map2017.png'>"),
("2018", "<img src='images/map2018.png'>")]
map_dropdown = Dropdown(name='Select Year:', menu=menu)
map_dropdown.on_change('value', maphandler)
map_row = row(map_dropdown, div)
layout = layout(map_row)
With my folder structure looking like this:
/bokeh_server
/images
map2016.png
map2017.png
map2018.png
main.py
This should work right? Yet when I run the server the image doesn't show up.