All Projects → pyqt → Examples

pyqt / Examples

Licence: gpl-3.0
Learn to create a desktop app with Python and Qt

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Examples

QtExamples
Translations of the official Qt examples into PyQt5 (also PySide2) and more.
Stars: ✭ 39 (-96.74%)
Mutual labels:  qt, pyqt5, qt5, pyqt
Scihubeva
A Cross Platform Sci-Hub GUI Application
Stars: ✭ 683 (-42.89%)
Mutual labels:  qt, qt5, pyqt5, pyqt
QtPyConvert
An automatic Python Qt binding transpiler to the Qt.py abstraction layer.
Stars: ✭ 66 (-94.48%)
Mutual labels:  pyqt5, qt5, pyqt
pyqt-resources
Tips and code snippets for PyQt developers
Stars: ✭ 26 (-97.83%)
Mutual labels:  pyqt5, qt5, pyqt
15 Minute Apps
15 minute (small) desktop apps built with PyQt
Stars: ✭ 3,086 (+158.03%)
Mutual labels:  gui, pyqt5, pyqt
Git Cola
git-cola: The highly caffeinated Git GUI
Stars: ✭ 1,787 (+49.41%)
Mutual labels:  gui, qt5, pyqt5
Qt5.cr
Qt5 bindings for Crystal, based on Bindgen
Stars: ✭ 182 (-84.78%)
Mutual labels:  gui, qt, qt5
PYQT StyleDesigner
PYQT Stylesheet designer tool for Stylesheet creation
Stars: ✭ 30 (-97.49%)
Mutual labels:  qt, pyqt5, pyqt
Qdarkstylesheet
A dark style sheet for QtWidgets application
Stars: ✭ 1,952 (+63.21%)
Mutual labels:  qt, qt5, pyqt5
Guitar
Git GUI Client
Stars: ✭ 1,136 (-5.02%)
Mutual labels:  gui, qt, qt5
Qt.go
Qt binding for Go (Golang) aims get Go's compile speed again.
Stars: ✭ 487 (-59.28%)
Mutual labels:  gui, qt, qt5
Nitroshare Desktop
Network file transfer application for Windows, OS X, & Linux
Stars: ✭ 1,150 (-3.85%)
Mutual labels:  gui, qt, qt5
Handwriter
A smart program to convert digital document to hand-written document
Stars: ✭ 108 (-90.97%)
Mutual labels:  gui, qt5, pyqt5
Stackoverflow
my answers in Stack Overflow
Stars: ✭ 211 (-82.36%)
Mutual labels:  qt, pyqt5, pyqt
Qml Creative Controls
QML controls for creative applications and creative coding
Stars: ✭ 199 (-83.36%)
Mutual labels:  gui, qt, qt5
Uranium
A Python framework for building Desktop applications.
Stars: ✭ 210 (-82.44%)
Mutual labels:  qt, pyqt5, pyqt
Galacteek
Browser for the distributed web
Stars: ✭ 114 (-90.47%)
Mutual labels:  qt5, pyqt5, pyqt
Qt Python Binding Examples
Lots of simple and Pythonic PySide demos
Stars: ✭ 312 (-73.91%)
Mutual labels:  gui, qt, pyqt5
Persepolis
Persepolis Download Manager is a GUI for aria2.
Stars: ✭ 5,218 (+336.29%)
Mutual labels:  gui, qt5, pyqt5
Lqt
Lua Binding for Qt5
Stars: ✭ 30 (-97.49%)
Mutual labels:  gui, qt, qt5

PyQt examples 2021

These PyQt examples show you how to create a desktop app with Python and Qt. Start with "Hello World" or browse the official PyQt demos. You can run every example yourself on Windows, Mac or Linux. All you need is Python 3. For instructions, please see below.

PyQt QLabel PyQt widgets screenshot QVBoxLayout PyQt5 PyQt Signals and Slots Qt Designer Python
Hello World! Common PyQt Widgets Layouts Signals and Slots Qt Designer & Python
QML Python example Qt Text Editor PyQt5 exe Qt dark theme
QML Python example Qt Text Editor Packaging & deployment Qt Dark Theme
QPainter Python example PyQt Thread example QTreeView example in Python PyQt5 QListView
Action Shooter Chat Client Tree Views Lists
QAbstractTableModel example QAbstractTableModel example
Custom Tables PyQt database example

These examples are taken from the following book:

PyQt5 book
Python and Qt: The Best Parts
by Michael Herrmann

Official PyQt demos

The PyQt source archive also contains a large number of sample files. You can find them reproduced here in the src/pyqt-official directory. The easiest way to start them is to follow the instructions about running examples below, then execute the following commands:

cd src/pyqt-official/qtdemo
python qtdemo.py

This starts the PyQt example launcher:

PyQt Examples launcher

You can use it to easily browse and run the official demo applications. The following examples are quite nice for instance:

  • Quick / Animation / ColorAnimation
  • Graphics Effects / Lighting and Shadows
  • Desktop / System Tray
  • Desktop / Screenshot
  • Widgets / Tetrix

Running the examples

Running the examples is really easy. The only thing you need is Python 3.

First, download the ZIP archive of this repository and unpack it. Open a command prompt and use cd to navigate into the top-level directory of the archive.

Create a virtual environment via the command:

python3 -m venv venv

This creates the folder venv/ in your current directory. It will contain the necessary libraries for running the examples.

To activate the virtual environment, use the following command:

# On Windows:
call venv\Scripts\activate.bat
# On Mac / Linux:
source venv/bin/activate

Now execute the following to install the necessary dependencies:

pip install -Ur src/requirements.txt

Once you have done this, use cd to navigate to the example you're interested in in the src/ folder. For example:

cd "src/01 PyQt QLabel"

You'll find a .py file there, typically main.py. You can run it with the command:

python main.py

Please note that the virtual environment must still be active for this to work.

Using PySide2

This repository uses PyQt5 to use Qt from Python. Another, alternative binding is PySide2 (also called "Qt for Python"). It is less mature than PyQt5 but has the advantage that you can use it for free in commercial projects.

If you want to use PySide2 instead of PyQt5, simply replace all mentions of the latter by the former. For instance, in src/requirements.txt, replace PyQt5 by PySide2. Similarly for any code examples: from PyQt5.QtWidgets ... becomes from PySide2.QtWidgets ... etc.

Alternatively, if you don't want to commit to either of the two bindings at this stage, you can also use Qt.py. This is an abstraction over PySide2 and PyQt5. It loads whichever of the two bindings is available. To use it for the examples presented here, replace all mentions of PyQt5 by just Qt.

Licensing

Except where otherwise indicated, you may use the source code of examples 1 - 15 in the src/ directory under the terms of the MIT or GPLv3 licenses.

The official PyQt demos in src/pyqt-official are licensed under the GPL.

The screenshots in this repository may be used under the terms of the CC BY-NC-SA 4.0 if you prominently mention and link to Michael Herrmann's PyQt5 book.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].