[PyKDE] [cappy2112@gmail.com: re:Multiple layouts on same Window]

Andreas Pakulat apaku at gmx.de
Fri Jan 26 22:15:42 GMT 2007

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):

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

       self.window = QtGui.QWidget()

       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.h_layout.addChildLayout(self.v1_layout )


def main(args):

       app = QtGui.QApplication(args)
       dialog = Dialog()
   except ImportError:
       print"\n%s.py could not be found" % 'nm2g2'

Andreas Pakulat* apaku at gmx.de
*Fri Jan 26 00:33:13 MET 2007*

  - Previous message: [PyKDE] Multiple layouts on same Window
  - Next message: [PyKDE] Re: embedding python widgets in C++ app
  - *Messages sorted by:* [ date


On 25.01.07 15:07:46, Tony Cappellini wrote:
>* Using this as a reference
*>* http://doc.trolltech.com/4.1/qvboxlayout.html#details
*>* I want to have two QVboxLayouts side by side, with buttons 6-10 in another
*>* QVBoxLayout on the same window.
*>* Ideally, there would be one vertical stack of widgets on the left, and
*>* another stack of vertical widgets on the right.
*>* Do I need to add another layout or container to the window first, in order
*>* to add 2 QVboxlayouts, side by side?
Yes, possibly a QHBoxLayout and then add the 2 vboxes as childlayouts of
that layout.


----- End forwarded message -----

Celebrate Hannibal Day this year.  Take an elephant to lunch.

More information about the PyQt mailing list