Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2012
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. import sys
  2. from PySide import QtGui
  3. from PySide import QtCore
  4.  
  5.  
  6. class StackTest( QtGui.QWidget):
  7.     def __init__( self, parent=None ):
  8.         QtGui.QWidget.__init__( self, parent )
  9.        
  10.         firstButton = QtGui.QPushButton('a')
  11.         secondButton = QtGui.QPushButton('b')
  12.         thirdButton = QtGui.QPushButton('c')
  13.        
  14.        
  15.         stackedWidget = QtGui.QStackedWidget()
  16.         stackedWidget.addWidget( firstButton )
  17.         stackedWidget.addWidget( secondButton )
  18.         stackedWidget.addWidget( thirdButton )
  19.        
  20.         pageComboBox = QtGui.QComboBox()
  21.         pageComboBox.setStyle
  22.         pageComboBox.addItems( ['Page 1', 'Page 2', 'Page 3'] )
  23.         QtCore.QObject.connect( pageComboBox, QtCore.SIGNAL( 'activated(int)'),
  24.                                 stackedWidget,
  25.                                 QtCore.SLOT('setCurrentIndex(int)') )
  26.        
  27.         layout = QtGui.QHBoxLayout()
  28.         layout.addWidget( pageComboBox )
  29.         layout.addWidget( stackedWidget )
  30.         self.setLayout( layout )
  31.        
  32.  
  33. if __name__ == '__main__':
  34.     app = QtGui.QApplication( sys.argv )
  35.     t =  StackTest()
  36.     t.show()
  37.     sys.exit( app.exec_() )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement