bootstack.Tooltip#
- class bootstack.Tooltip(target, text='', *, delay=250, accent=None, wrap_width=None, justify='left', anchor_point=None, window_point=None, auto_flip=True)#
Bases:
objectA hover tooltip attached to a target widget.
The tooltip appears after
delaymilliseconds when the mouse enters the target and disappears when the mouse leaves or clicks. Positioning follows the mouse cursor by default; passanchor_pointandwindow_pointto pin the tooltip to a specific edge of the widget instead.- Parameters:
target (PublicWidgetBase | Any) – Widget to attach the tooltip to. Accepts any bootstack widget.
text (str) – Tooltip text content. Defaults to
''.delay (int) – Milliseconds before the tooltip appears on mouse enter. Defaults to
250.accent (AccentToken | str | None) – Semantic color accent. Defaults to the theme’s elevated background color.
wrap_width (int | None) – Maximum text width in pixels before wrapping. Defaults to
None(auto-scaled to approximately 300 px).justify (Justify) – Text alignment inside the tooltip. Defaults to
'left'.anchor_point (Anchor | None) – Anchor on the target widget the tooltip attaches to. Defaults to
None(tooltip follows the mouse).window_point (Anchor | None) – Anchor on the tooltip window aligned to
anchor_point. Defaults to the opposite ofanchor_pointwhen it is set.auto_flip (bool | Literal['vertical', 'horizontal']) – Keep the tooltip fully on screen.
Trueflips both axes,Falsedisables flipping,'vertical'or'horizontal'restricts flipping to one axis. Defaults toTrue.
- destroy()#
Remove the tooltip and unbind all event handlers.