I am experiencing strange behaviour, the hover tool doesn’t show tooltips when created inside a callback. Here is the simplest example:
from bokeh.plotting import Figure, curdoc
from bokeh.layouts import column
from bokeh.models.tools import HoverTool
from bokeh.resources import CDN
from bokeh.embed import server_document, server_session
from bokeh.client import push_session
from bokeh.models import Button
doc = curdoc()
button = Button(label='Add Plot', button_type="success", name='my_button'
)
plots_layout = column(button)
def callback():
hover = HoverTool(tooltips='hi' )
plot = Figure()
plot.add_tools(hover)
plots_layout.children.append(plot)
plot.line([1, 2], [1, 2
])
button.on_click(callback)
doc.add_root(plots_layout)
session = push_session(curdoc())
session.show()
session.loop_until_closed()
Interesting that it works after refreshing the page.
