Qt for Python is the project that provides the official set of Python bindings (PySide2) that will supercharge your Python applications. While the Qt APIs are world renowned, there are more reasons why you should consider Qt for Python. The first official release of the PySide2 module is available now!
Pretty much everything you can do with Qt, you can now do in Python! Check out our how-to guides, tutorials, and examples to get you on the right track from day one. Here's how you can quickly deliver performant, flexible and scalable Qt applications.
Qt for Python keeps Qt syntax to enable you to move without much trouble from C++ to Python or the other way around. Here's a quick example to show you just how simple it is!
import sys import random from PySide2.QtWidgets import (QApplication, QLabel, QPushButton, QVBoxLayout, QWidget) from PySide2.QtCore import Slot, Qt class MyWidget(QWidget): def __init__(self): QWidget.__init__(self) self.hello = ["Hallo Welt", "你好，世界", "Hei maailma", "Hola Mundo", "Привет мир"] self.button = QPushButton("Click me!") self.text = QLabel("Hello World") self.text.setAlignment(Qt.AlignCenter) self.layout = QVBoxLayout() self.layout.addWidget(self.text) self.layout.addWidget(self.button) self.setLayout(self.layout) # Connecting the signal self.button.clicked.connect(self.magic) @Slot() def magic(self): self.text.setText(random.choice(self.hello)) if __name__ == "__main__": app = QApplication(sys.argv) widget = MyWidget() widget.resize(800, 600) widget.show() sys.exit(app.exec_())
A collection of code samples and tutorials are provided to help new users get started with Qt. They cover a range of topics, from basic step-by-step tutorials to more complex guides.
Qt makes developers more productive and it makes programming fun. With this official tech preview, we're now sharing all the Qt goodies with the Python community. Join us and learn, share and connect!