<s> try : <EOL> from PyQt4 import QtGui , QtCore <EOL> except ImportError : <EOL> from PyQt5 import QtGui , QtCore <EOL> class WizardCreator ( QtGui . QWizard ) : <EOL> def __init__ ( self , title = "<STR_LIT>" , pages = [ ] ) : <EOL> super ( WizardCreator , self ) . __init__ ( None , <EOL> QtCore . Qt . WindowSystemMenuHint | QtCore . Qt . WindowTitleHint ) <EOL> self . setWindowTitle ( title ) <EOL> for page in pages : <EOL> self . create_page ( page ) <EOL> self . show ( ) <EOL> def create_page ( self , page ) : <EOL> new_page = QtGui . QWizardPage ( ) <EOL> layout = QtGui . QVBoxLayout ( ) <EOL> for kind , value in page : <EOL> if kind . lower ( ) == "<STR_LIT:title>" : <EOL> new_page . setTitle ( value ) <EOL> elif kind . lower ( ) == "<STR_LIT:text>" : <EOL> label = QtGui . QLabel ( value ) <EOL> label . setWordWrap ( True ) <EOL> layout . addWidget ( label ) <EOL> elif kind . lower ( ) == "<STR_LIT:image>" : <EOL> label = QtGui . QLabel ( ) <EOL> pixmap = QtGui . QPixmap ( value ) <EOL> label . setPixmap ( pixmap ) <EOL> layout . addWidget ( label ) <EOL> elif kind . lower ( ) == "<STR_LIT>" : <EOL> h_layout = QtGui . QHBoxLayout ( ) <EOL> h_box = QtGui . QGroupBox ( '<STR_LIT>' ) <EOL> for image in value : <EOL> label = QtGui . QLabel ( ) <EOL> pixmap = QtGui . QPixmap ( image ) <EOL> label . setPixmap ( pixmap ) <EOL> h_layout . addWidget ( label ) <EOL> h_box . setLayout ( h_layout ) <EOL> layout . addWidget ( h_box ) <EOL> new_page . setLayout ( layout ) <EOL> self . addPage ( new_page ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app = QtGui . QApplication ( [ ] ) <EOL> page1 = [ ( "<STR_LIT:text>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT:image>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT:text>" , "<STR_LIT>" ) ] <EOL> page2 = [ ( "<STR_LIT:text>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT:image>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT:text>" , "<STR_LIT>" ) ] <EOL> page3 = [ ( "<STR_LIT:text>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT:title>" , "<STR_LIT>" ) ] <EOL> page4 = [ ( "<STR_LIT>" , [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) ] <EOL> page5 = [ ( "<STR_LIT:text>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) ) , <EOL> ( "<STR_LIT:text>" , "<STR_LIT>" ) ] <EOL> pages = [ page1 , page2 , page3 , page4 , page5 ] <EOL> wizard = WizardCreator ( title = "<STR_LIT>" , pages = pages ) <EOL> wizard . exec_ ( ) <EOL> app . quit ( ) </s>
