Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PySide import QtGui
- from PySide import QtCore
- class StackTest( QtGui.QWidget):
- def __init__( self, parent=None ):
- QtGui.QWidget.__init__( self, parent )
- firstButton = QtGui.QPushButton('a')
- secondButton = QtGui.QPushButton('b')
- thirdButton = QtGui.QPushButton('c')
- stackedWidget = QtGui.QStackedWidget()
- stackedWidget.addWidget( firstButton )
- stackedWidget.addWidget( secondButton )
- stackedWidget.addWidget( thirdButton )
- pageComboBox = QtGui.QComboBox()
- pageComboBox.setStyle
- pageComboBox.addItems( ['Page 1', 'Page 2', 'Page 3'] )
- QtCore.QObject.connect( pageComboBox, QtCore.SIGNAL( 'activated(int)'),
- stackedWidget,
- QtCore.SLOT('setCurrentIndex(int)') )
- layout = QtGui.QHBoxLayout()
- layout.addWidget( pageComboBox )
- layout.addWidget( stackedWidget )
- self.setLayout( layout )
- if __name__ == '__main__':
- app = QtGui.QApplication( sys.argv )
- t = StackTest()
- t.show()
- sys.exit( app.exec_() )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement