Skip to content

API Reference

GuidedTour

GuidedTour

Bases: QObject

Run a guided tour over a sequence of TourStep objects.

Parameters:

Name Type Description Default
steps Sequence[TourStep]

Ordered tour steps.

required
parent_window QWidget

Window or top-level widget the overlay and tooltip are parented to.

required

start() -> None

Start the tour.

close() -> None

Close the tour and emit finished.

eventFilter(a0: QObject | None, a1: QEvent | None) -> bool

Handle resize and Escape events while the tour is active.

Parameters:

Name Type Description Default
a0 QObject or None

Watched object.

required
a1 QEvent or None

Event sent to the watched object.

required

Returns:

Type Description
bool

True if the event was handled by the tour.

TourStep

TourStep dataclass

One step in a guided tour.

Parameters:

Name Type Description Default
target Callable[[], QWidget | None]

Callable returning the widget to highlight. Return None to skip the step until the target exists.

required
title str

Popover title.

required
body str

Popover body. Qt rich text is supported by QLabel.

required
anchor TourAnchor

Tooltip placement relative to the target.

TourAnchor.RIGHT
skip Callable[[], bool]

Callable returning True when this step should be skipped.

lambda: False
ensure_visible Callable[[], bool]

Callable run before showing the step. Return True if it just revealed or relaid out the target so geometry should be read on the next event-loop tick.

lambda: False

TourAnchor

TourAnchor

Bases: Enum

Tooltip placement relative to the target widget.

Values
LEFT = "left"
RIGHT = "right"
ABOVE = "above"
BELOW = "below"
CENTER = "center"