Advanced features of Qt for Python or PySide2

The first thing that we want to learn about here is stretching. We know how to add widgets to a box layout (vertical or horizontal). However, we can configure to some extent how to distribute these widgets that we added into a box layout. Should we stretch the widgets, put the widgets on top for the horizontal layout, and let the space devour the rest?

Let's create a script to explain this configuration of widget distribution in a box layout and name the script add_stretch.py (refer to the code file on the following GitLab link for the full code: https://gitlab.com/arjunaskykok/hands-on-blockchain-for-python-developers/blob/master/chapter_09/advanced_course_qt/add_stretch.py):

from PySide2.QtWidgets ...

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.