If I run this code:
#!/usr/local/bin/ python3 import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class Window(QMainWindow): def
In another case, the solution was to add all child objects to a detached layout first, and adding the layout to the parent layout as the last step. That is:
l = QGridLayout() l.addWidget(QLabel("child1"), 0, 0) l.addWidget(QLabel("child2"), 0, 1) ... parentLayout.addLayout(l)