[PyKDE] Re: PyKDE Digest, Vol 30, Issue 49

Tony Cappellini cappy2112 at gmail.com
Sun Jan 28 03:21:19 GMT 2007


Is this what you mean?
If not- would you add an example?




from PyQt4 import QtCore, QtGui

import sys

class Dialog(QtGui.QDialog):

    def __init__(self,parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.button1 = QtGui.QPushButton("One")
        self.button2 = QtGui.QPushButton("Two")
        self.button3 = QtGui.QPushButton("Three")
        self.button4 = QtGui.QPushButton("Four")

        self.h_layout = QtGui.QHBoxLayout()

        self.v1_layout = QtGui.QVBoxLayout()
        self.v2_layout = QtGui.QVBoxLayout()

        self.v1_layout.addWidget(self.button1)
        self.v1_layout.addWidget(self.button2)
        self.v2_layout.addWidget(self.button3)
        self.v2_layout.addWidget(self.button4)

        self.h_layout.addChildLayout(self.v1_layout)
        self.h_layout.addChildLayout(self.v2_layout)

        self.setLayout(self.h_layout)


def main(args):

    app = QtGui.QApplication(args)
    dlg = Dialog()
    dlg.show()
    sys.exit(app.exec_())

#--------------------------------------------------

if __name__ == "__main__":
    main(sys.argv)


Message: 1
Date: Fri, 26 Jan 2007 23:15:42 +0100
From: Andreas Pakulat <apaku at gmx.de>
Subject: [PyKDE] [cappy2112 at gmail.com: re:Multiple layouts on same
       Window]
To: PyKDE <pykde at mats.imk.fraunhofer.de>
Message-ID: <20070126221542.GA2160 at morpheus.apaku.dnsalias.org>
Content-Type: text/plain; charset=us-ascii

Please stay on the list.

What I see there: The QWidget doesn't have a
parent, which means it is not a child of your dialog. Also it's show()
method is never called, so it doesn't display.
And last but not least: You don't need the QWidget, just set the layout
on the dialog.

----- Forwarded message from Tony Cappellini <cappy2112 at gmail.com> -----

*Hello Andreas,

Thanks for the reply.

I've added 2 QVBoxLayouts as children of the QHBoxLayout.
A tiny window appears without any widgets.
What have I not done correctly?

class Dialog(QtGui.QDialog):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070128/ec350c9a/attachment.html


More information about the PyQt mailing list