I have 2 QPushButton
in the app window: btn1
needs to be 5x the height of btn2
.
Problem: Tried setting the row span of self.btn1
to 5
using layout.addWidget
but the height remains unchanged. did I miss out on a setting?
import sys
from PyQt4 import QtGui, QtCore
class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.initUI()
def initUI(self):
layout = QtGui.QGridLayout()
self.btn1 = QtGui.QPushButton('Hello')
self.btn2 = QtGui.QPushButton('World')
layout.addWidget(self.btn1, 1, 1, 5, 1)
layout.addWidget(self.btn2, 6, 1, 1, 1)
centralWidget = QtGui.QWidget()
centralWidget.setLayout(layout)
self.setCentralWidget(centralWidget)
def main():
app = QtGui.QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()