Skip to content


PySide2 is a Python binding for the Qt application framework. Qt is a powerful and popular C++ library for building graphical user interfaces (GUIs), and PySide2 allows you to use Qt in Python applications. It provides Python bindings for the Qt libraries, enabling you to create cross-platform desktop applications with a native look and feel.

Here are some key points about PySide2:

  1. Cross-Platform: PySide2 supports Windows, macOS, and various Linux distributions, making it a cross-platform solution for GUI development.
  2. Qt Integration: PySide2 provides Pythonic bindings for the Qt framework, allowing you to leverage Qt’s extensive set of tools and features for creating GUI applications.
  3. Qt Designer: You can design your GUIs visually using Qt Designer, a drag-and-drop interface builder, and then load these designs into your PySide2 application.
  4. Open Source: PySide2 is open source and released under the LGPL (Lesser General Public License) or a commercial license, depending on your project’s requirements.
  5. Rich Widgets: It offers a wide range of widgets and features, such as buttons, dialogs, layouts, graphics view framework, and more, to help you create feature-rich desktop applications.

Here’s a basic example of a simple PySide2 application that creates a window with a button:

import sys
from PySide2.QtWidgets import QApplication, QMainWindow, QPushButton

def on_button_click():
    print("Button clicked!")

app = QApplication(sys.argv)
window = QMainWindow()
window.setWindowTitle("PySide2 Example")
button = QPushButton("Click me!")

This code creates a PySide2 application with a window containing a button. When the button is clicked, it prints a message to the console.

Keep in mind that PySide2 was succeeded by PySide6, and as of my last knowledge update in September 2021, PySide6 was the latest version. Depending on the current date and developments in the PySide project, there might be newer versions available.

Leave a Reply

Your email address will not be published. Required fields are marked *


Enjoy this blog? Please spread the word :)