Getting Started With Pyside2 | Qt For Python – this is my first article on Pyside2(Qt For Python), so in this article we are not going to
touch the coding section, but we are going to to have some introduction on Pyside2 and also we are going to talk about the installation process.
Before this i had a lot of articles on PyQt5, that is also a GUI framework for Python Programming Language
PyQt5 GUI Development Complete Articles
Qt For Python (Pyside2)
Qt for Python offers Python bindings for Qt, enabling the use of Qt5 APIs in Python applications. It lets Python developers utilize the
full potential of Qt, using the PySide2 module.
The PySide2 module provides access to the individual Qt modules such as QtCore, QtGui, and so on. Qt for Python also comes with the
Shiboken2 CPython binding code generator, which can be used to generate Python bindings for your C or C++ code.
What is Shiboken2 ?
Shiboken is the CPython-based binding code generator for C or C++ libraries. It uses an ApiExtractor library to parse the C or C++ headers and get the type
information, using Clang. The library can also be used to parse non-Qt projects. The following diagram summarizes Shiboken’s role in the PySide project.
A typesystem file (XML) is used to specify the types to be exposed to Python and to apply modifications to properly represent and manipulate the types in the Python World. For example, you can remove and add methods to certain types, and also modify the arguments of each method. Such actions are inevitable to properly handle the data structures or types.
The final outcome of this process is a set of wrappers written in CPython, which can be used as a module in your python code.
Qt For Python Modules
Basics Modules
These are the main modules that will help you build a Widget based UI.
- Qt Core : Provides core non-GUI functionality, like signal and slots, properties, base classes of item models, serialization, etc.
- Qt GUI : Extends QtCore with GUI functionality: Events, windows and screens, OpenGL and raster-based 2D painting, images.
- Qt Widgets: Ready to use Widgets for your application, including also graphical elements for your UI.
QML And QtQuick
If you want to use the Qml Language <https://doc.qt.io/qt-5/qmlapplications.html>, these modules will help you interact with it from Python.
- Qt QML : Base Python API to interact with the QML module.
- Qt Quick: Provides classes for embedding Qt Quick in Qt applications.
- Qt QuickWidgets: Provides the QQuickWidget class for embedding Qt Quick in widget-based applications.
Data Visualization
Charts, diagrams, animations: these modules provide a large amount of classes that can help you include these elements in your UI.
- Qt Charts: Provides a set of easy to use chart components.
- Qt Data Visualization: Provides a way to visualize data in 3D as bar, scatter, and surface graphs.
Multimedia
Audio, video, and hardware interaction: check these modules if you are looking for multimedia solutions.
- Qt Multimedia: Provides low-level multimedia functionality.
- Qt Multimedia Widgets: Provides the widget-based multimedia API.
WebEngine
If your project is based on a browser or the features around web based applications, these modules will help you to interact with them.
- QtWebEngineWidgets: Provides widgets that can handle web content.
- Qt WebChannel: Enables peer-to-peer communication between a server and a client (HTML/JavaScript or QML application).
There are many other modules currently supported by PySide2, here you can find a complete list of them from Qt Documentation .
Installation
Since the release of the Technical Preview it is possible to install via pip
, both from Qt’s servers and PyPi
1 |
pip install PySide2 |
Also for more details installation you can check pypi.org
Watch the complete video for this article
Subscribe and Get Free Video Courses & Articles in your Email