PySide/QT - How to add horizontal or vertical layout to a grid layout <p>If I wanted to create a window where a grid layout didn't cover the whole frame? Could I do it by adding a horizontal layout to the grid layout and adding a stretch to the horizontal layout. When I try it in the following code, I get this error: </p> <blockquote> <p>TypeError: PySide.QtGui.QGridLayout.addLayout(): not enough arguments</p> </blockquote> <pre><code>import sys from PySide import QtGui class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.initUI() def initUI(self): names = ['Cls', 'Bck', '', 'Close', '7', '8', '9', '/', '4', '5', '6', '*', '1', '2', '3', '-', '0', '.', '=', '+'] hbox = QtGui.QHBoxLayout() hbox.addStretch() vbox = QtGui.QVBoxLayout() vbox.addStretch() grid = QtGui.QGridLayout() grid.addLayout(vbox) self.setLayout(grid) self.move(300, 150) self.setWindowTitle('Calculator') self.show() def main(): app = QtGui.QApplication(sys.argv) ex = Example() sys.exit(app.exec_()) if __name__ == '__main__': main() </code></pre> <p>This error does not occur when adding a horizontal layout to a vertical layout or vice versa. </p> <p>Thanks for the help!</p>