QtTutorial#
Guided tutorial overlays that walk the user through a sequence of widgets.
Screenshot#

Example#
Source: examples/qt_tutorial.py
"""QtTutorial example."""
from qtpy.QtWidgets import QApplication, QPushButton, QVBoxLayout, QWidget
from qtextra.config import THEMES
from qtextra.widgets.qt_tutorial import Position, QtTutorial, TutorialStep
def create_popout():
"""Create a popout."""
text = """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Vestibulum lorem sed risus ultricies tristique nulla aliquet. Malesuada nunc vel risus
commodo viverra maecenas."""
pop = QtTutorial(widget)
pop.set_steps(
[
TutorialStep(
title=f"{position}",
message=text,
widget=button,
position=position,
)
for position in Position
],
)
pop.show()
pop.raise_()
pop.activateWindow()
pop.set_step(2)
app = QApplication([])
widget = QWidget()
widget.setMinimumSize(600, 300)
THEMES.apply(widget)
layout = QVBoxLayout()
widget.setLayout(layout)
layout.addWidget(button := QPushButton("Press me to see popout"))
button.clicked.connect(create_popout)
widget.show()
create_popout()
app.exec_()
Notes#
- Tutorial steps point at target widgets and can place the callout in many relative positions.
API#
Qt Class#
Methods#
Tutorial step widget.
ALLOW_CHEVRON = True
class-attribute
instance-attribute
#
MAX_WIDTH = 450
class-attribute
instance-attribute
#
MIN_HEIGHT = 40
class-attribute
instance-attribute
#
MIN_WIDTH = 350
class-attribute
instance-attribute
#
add_step(step: TutorialStep) -> None
#
Add a step to the tutorial.
make_ui() -> None
#
Setup UI.
move_to_widget(widget: QWidget, position: str = 'right', position_offset: tuple[int, int] = (0, 0)) -> None
#
Move tutorial to specified widget.
on_next() -> None
#
Next step.
on_prev() -> None
#
Previous step.
set_chevron(position: Position) -> None
#
Show/hide chevron icons as required.
set_step(index: int) -> None
#
Show step.
set_steps(steps: ty.List[TutorialStep]) -> None
#
Set steps.
Methods#
Tutorial step.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str
|
Title of the tutorial step. |
message |
str
|
Message to display. Can be HTML. |
widget |
QWidget
|
Widget to associate tutorial with. If widget is provided, chevron icon will be shown and it will point towards it. |
position |
Position
|
The position of the tutorial chevron. |
position_offset |
tuple[int, int]
|
Offset position of the tutorial chevron. |
Methods#
Position.