Revision 643239633436 () - Diff

Link to this snippet: https://friendpaste.com/4Cm20xVTIaHvVqokpfVv3f
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys
from PySide import QtCore, QtGui

class Test(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)

self.button = QtGui.QPushButton(self)
self.button.setText(QtCore.QString("Push me"))
self.setCentralWidget(self.button)

self.secondWindow = QtGui.QMainWindow(self)
self.secondWindow.setParent(self)

self.connect(self.button, QtCore.SIGNAL("clicked()"), self.openSecondWindow)

def openSecondWindow(self):
print "Activate second window"
self.secondWindow.show()

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
test = Test()
test.show()
sys.exit(app.exec_())