simvx.core.ui.tooltip

TooltipManager: hover-triggered floating tooltip, rendered via the overlay layer.

Module Contents

Classes

TooltipManager

Manages tooltip display for the UI system.

Data

API

simvx.core.ui.tooltip.log

‘getLogger(…)’

simvx.core.ui.tooltip.__all__

[‘TooltipManager’]

class simvx.core.ui.tooltip.TooltipManager(show_delay: float = 0.5, screen_width: float = 800, screen_height: float = 600, root: simvx.core.ui.core.Control | None = None)[source]

Manages tooltip display for the UI system.

Not a Control subclass. Intended to be owned by SceneTree or the application layer and updated each frame. The actual rendering is routed through an internal :class:_TooltipOverlay registered on the overlay layer, so tooltips paint through the single collector on every backend (no manual draw call).

Example: tip = TooltipManager(root=ui_root) # In the frame loop: control = tree._find_control_at_point(mouse_pos) tip.update(dt, mouse_pos, control) # No draw() call: the overlay layer renders the tip box on top.

Initialization

attach(root: simvx.core.ui.core.Control) None[source]

Parent the tooltip overlay Control under root so it can register.

The overlay needs a Control ancestor in the scene tree to obtain a tree reference (the overlay registry is tree-owned). Call this once the UI root exists if it was not supplied to __init__.

set_text(text: str) None[source]

Override the displayed tooltip text (kept for the manager’s public API).

update(dt: float, mouse_pos, control_at_pos: simvx.core.ui.core.Control | None)[source]

Update tooltip state. Call once per frame.

Args: dt: Frame delta time in seconds. mouse_pos: Current mouse position (Vec2 or tuple). control_at_pos: The topmost Control under the cursor, or None.