Getting Started

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.

Show Me the Code

Here's how easy it is to install and write your first application.

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_ ())

Get started with Tutorials

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.