Before we add another widget, we must learn about the concept of layout. We will use two layouts, which are QHBoxLayout and QVBoxLayout. These two layouts are enough to create a GUI application. There are other layouts, such as QGridLayout and QFormLayout, among many others, but we do not need them. QHBoxLayout and QVBoxLayout are like flexbox in CSS. You place widgets in a container that uses QHBoxLayout, and then all widgets will be put in a horizontal line. Let's take a look at an example. Name this script

import sysfrom PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout, QPushButton, QLabelapp = QApplication(sys.argv)hello_button = QPushButton('Hello')very_label = QLabel('Very Very')beautiful_button ...

Get Hands-On Blockchain for Python Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.