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 hello_horizontal_layout.py:
import sysfrom PySide2.QtWidgets import QApplication, QWidget, QHBoxLayout, QPushButton, QLabelapp = QApplication(sys.argv)hello_button = QPushButton('Hello')very_label = QLabel('Very Very')beautiful_button ...