I’m trying to implement a tooltip for a Button
which is only visible when the user hovers over the button. Something like this seems to be supported with the target
attribute of the ToolTip
model, which allows applying tooltips to arbitrary widgets.
Here is a minimal example:
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models import Button, Tooltip
from bokeh.resources import INLINE
from bokeh.util.browser import view
button = Button(label='Hello world')
tooltip = Tooltip(content='My Tooltip', position='right', visible=True, target=button)
doc = Document()
doc.add_root(button)
doc.add_root(tooltip)
with open('test.html', 'w') as f:
f.write(file_html(doc, INLINE, 'Hello world'))
view('test.html')
However, the tooltip seems to be always visible and I couldn’t find a way to make it only appear when the user hovers over the button (which is my understanding of what a “tool tip” typically is). Is this possible?