PyQt5 Tutorial - Grid Layout

PyQt5 Tutorial - Grid Layout

We will learn another layout method in PyQt5 in this tutorial - grid layout. PyQt5 Grid Layout The QGridLayout class lays out widgets in a grid. QGridLayout takes the available space to it and divides it up into rows and columns and then puts each widget into the correct cell. import sys from PyQt5.QtWidgets import (QWidget, QGridLayout,QPushButton, QApplication) class basicWindow(QWidget): def __init__(self): super().__init__() grid_layout = QGridLayout() self.setLayout(grid_layout) for x in range(3): for y in range(3): button = QPushButton(str(str(3*x+y))) grid_layout.

Jan 03, 2023


Python Tkitner Tkinter JavaScript Matplotlib PyQt5 Algorithm

Most Popular Articles

Recently Updated Articles