I have a PyQt5 MainWindow which contains just a QGridLayout. the QGridLayout contains only two rows of QLabel widget just for test.
But the two rows of QLabel is far from together and loose. How can I make rows close together and align the QGridLayout at top of MainWindow? Code here, thanks!
class MainWindow(Ui_MainWindow, QMainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.gridLayout.addWidget(QLabel('First Row'), 0, 0)
self.gridLayout.addWidget(QLabel('Second Row,oh! Ugly'), 1, 0)
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()