| a | b | |
|---|
| 0 | + | import sys |
|---|
| 0 | + | from PySide import QtCore, QtGui |
|---|
| 0 | + | |
|---|
| 0 | + | class Test(QtGui.QMainWindow): |
|---|
| 0 | + | def __init__(self): |
|---|
| 0 | + | QtGui.QMainWindow.__init__(self) |
|---|
| 0 | + | |
|---|
| 0 | + | self.button = QtGui.QPushButton(self) |
|---|
| 0 | + | self.button.setText(QtCore.QString("Push me")) |
|---|
| 0 | + | self.setCentralWidget(self.button) |
|---|
| 0 | + | |
|---|
| 0 | + | self.secondWindow = QtGui.QMainWindow(self) |
|---|
| 0 | + | self.secondWindow.setParent(self) |
|---|
| 0 | + | |
|---|
| 0 | + | self.connect(self.button, QtCore.SIGNAL("clicked()"), self.openSecondWindow) |
|---|
| 0 | + | |
|---|
| 0 | + | def openSecondWindow(self): |
|---|
| 0 | + | print "Activate second window" |
|---|
| 0 | + | self.secondWindow.show() |
|---|
| 0 | + | |
|---|
| 0 | + | if __name__ == '__main__': |
|---|
| 0 | + | app = QtGui.QApplication(sys.argv) |
|---|
| 0 | + | test = Test() |
|---|
| 0 | + | test.show() |
|---|
| 0 | + | sys.exit(app.exec_()) |
|---|
| ... | |
|---|