trivialwizard.py¶
"""PySide6 port of the widgets/dialogs/trivialwizard example from Qt v5.x"""
from PySide6 import QtWidgets
def createIntroPage():
page = QtWidgets.QWizardPage()
page.setTitle("Introduction")
label = QtWidgets.QLabel("This wizard will help you register your copy of "
"Super Product Two.")
label.setWordWrap(True)
layout = QtWidgets.QVBoxLayout()
layout.addWidget(label)
page.setLayout(layout)
return page
def createRegistrationPage():
page = QtWidgets.QWizardPage()
page.setTitle("Registration")
page.setSubTitle("Please fill both fields.")
nameLabel = QtWidgets.QLabel("Name:")
nameLineEdit = QtWidgets.QLineEdit()
emailLabel = QtWidgets.QLabel("Email address:")
emailLineEdit = QtWidgets.QLineEdit()
layout = QtWidgets.QGridLayout()
layout.addWidget(nameLabel, 0, 0)
layout.addWidget(nameLineEdit, 0, 1)
layout.addWidget(emailLabel, 1, 0)
layout.addWidget(emailLineEdit, 1, 1)
page.setLayout(layout)
return page
def createConclusionPage():
page = QtWidgets.QWizardPage()
page.setTitle("Conclusion")
label = QtWidgets.QLabel("You are now successfully registered. Have a nice day!")
label.setWordWrap(True)
layout = QtWidgets.QVBoxLayout()
layout.addWidget(label)
page.setLayout(layout)
return page
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
wizard = QtWidgets.QWizard()
wizard.addPage(createIntroPage())
wizard.addPage(createRegistrationPage())
wizard.addPage(createConclusionPage())
wizard.setWindowTitle("Trivial Wizard")
wizard.show()
sys.exit(wizard.exec_())
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.