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: object

A hover tooltip attached to a target widget.

The tooltip appears after delay milliseconds when the mouse enters the target and disappears when the mouse leaves or clicks. Positioning follows the mouse cursor by default; pass anchor_point and window_point to 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 of anchor_point when it is set.

  • auto_flip (bool | Literal['vertical', 'horizontal']) – Keep the tooltip fully on screen. True flips both axes, False disables flipping, 'vertical' or 'horizontal' restricts flipping to one axis. Defaults to True.

destroy()#

Remove the tooltip and unbind all event handlers.