View Single Post
Posts: 272 | Thanked: 52 times | Joined on Jan 2010
#1
I have been looking for examples on how to do stackable windows using pyqt.. I found the following on this forum:

Code:
class StackedWindow(QtGui.QMainWindow):
    def __init__(self, *args):
        apply(QtGui.QMainWindow.__init__, (self, ) + args)
        self.setWindowTitle("Stacked Window")
        centralwidget = QtGui.QWidget(self)
        frame = QtGui.QFrame(centralwidget)
        verticalLayout = QtGui.QVBoxLayout(frame)
        pushButton = QtGui.QPushButton("Push Button 1", frame)
        verticalLayout.addWidget(pushButton)
        pushButton_2 = QtGui.QPushButton("Push Button 2", frame)
        verticalLayout.addWidget(pushButton_2)
        lineEdit = QtGui.QLineEdit(frame)
        verticalLayout.addWidget(lineEdit)
        lineEdit_2 = QtGui.QLineEdit(frame)
        verticalLayout.addWidget(lineEdit_2)
        self.setCentralWidget(centralwidget)
This does indeed create a new window with widgets on it, however I want the window to be stackable so it has a back button top right rather than a close button which the above produces.

Can anyone point me in the right direction?

On a side note, what's the best way of showing results that you may want to click on (think witter or facebrick style), I'm using a qtextbrowser at the minute and its not exactly what i'm after.

Edit: Also is there a way of creating the secondary window in Qt Designer and including the ui somehow?

Thanks