{"id":13595722,"url":"https://github.com/pyqt/examples","last_synced_at":"2025-05-14T02:04:47.114Z","repository":{"id":39673860,"uuid":"70778557","full_name":"pyqt/examples","owner":"pyqt","description":"Learn to create a desktop app with Python and Qt","archived":false,"fork":false,"pushed_at":"2025-01-07T06:29:45.000Z","size":3783,"stargazers_count":2486,"open_issues_count":8,"forks_count":588,"subscribers_count":78,"default_branch":"_","last_synced_at":"2025-04-12T19:42:57.059Z","etag":null,"topics":["gui","pyqt","pyqt5","pyqt5-examples","pyqt5-tutorial","pyside2","python","python3","qt","qt5"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyqt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-13T07:03:35.000Z","updated_at":"2025-04-11T08:23:32.000Z","dependencies_parsed_at":"2025-01-17T13:06:25.937Z","dependency_job_id":"942af851-a08b-424c-b213-0ffbfe823893","html_url":"https://github.com/pyqt/examples","commit_stats":{"total_commits":69,"total_committers":12,"mean_commits":5.75,"dds":"0.18840579710144922","last_synced_commit":"a72871707b2bceba07a765f001a3da7ad1b8b9dd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyqt%2Fexamples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyqt%2Fexamples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyqt%2Fexamples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyqt%2Fexamples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyqt","download_url":"https://codeload.github.com/pyqt/examples/tar.gz/refs/heads/_","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052668,"owners_count":22006716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","pyqt","pyqt5","pyqt5-examples","pyqt5-tutorial","pyside2","python","python3","qt","qt5"],"created_at":"2024-08-01T16:01:56.361Z","updated_at":"2025-05-14T02:04:47.084Z","avatar_url":"https://github.com/pyqt.png","language":"Python","readme":"# PyQt examples 2022\n\nThese 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](#running-the-examples).\n\n| \u003ca href=\"src/01 PyQt QLabel\"\u003e\u003cimg src=\"src/screenshots/pyqt-qlabel.png\" alt=\"PyQt QLabel\" width=100px\u003e\u003c/a\u003e | \u003ca href=\"src/02 PyQt Widgets\"\u003e\u003cimg src=\"src/screenshots/pyqt-widgets.png\" alt=\"PyQt widgets screenshot\" width=200px\u003e\u003c/a\u003e | \u003ca href=\"src/03 QVBoxLayout PyQt6\"\u003e\u003cimg src=\"src/screenshots/qvboxlayout-pyqt5.png\" alt=\"QVBoxLayout PyQt6\" width=100px\u003e\u003c/a\u003e | \u003ca href=\"src/04 PyQt Signals and Slots\"\u003e\u003cimg src=\"src/screenshots/pyqt-signals-and-slots.jpg\" alt=\"PyQt Signals and Slots\" width=170px\u003e\u003c/a\u003e | \u003ca href=\"src/05 Qt Designer Python\"\u003e\u003cimg src=\"src/screenshots/qt-designer-windows.png\" alt=\"Qt Designer Python\" width=190px\u003e\u003c/a\u003e |\n| :--: | :--: | :--: | :--: | :--: |\n| \u003ca href=\"src/01 PyQt QLabel\"\u003eHello World!\u003c/a\u003e | \u003ca href=\"src/02 PyQt Widgets\"\u003eCommon PyQt Widgets\u003c/a\u003e | \u003ca href=\"src/03 QVBoxLayout PyQt6\"\u003eLayouts\u003c/a\u003e | \u003ca href=\"src/04 PyQt Signals and Slots\"\u003eSignals and Slots\u003c/a\u003e | \u003ca href=\"src/05 Qt Designer Python\"\u003eQt Designer \u0026 Python\u003c/a\u003e |\n\n| \u003ca href=\"src/06 QML Python example\"\u003e\u003cimg src=\"src/screenshots/qml-python-example.png\" alt=\"QML Python example\" width=200px\u003e\u003c/a\u003e | \u003ca href=\"src/07 Qt Text Editor\"\u003e\u003cimg src=\"src/screenshots/qt-text-editor.png\" alt=\"Qt Text Editor\" width=180px\u003e\u003c/a\u003e | \u003ca href=\"src/08 PyQt6 exe\"\u003e\u003cimg src=\"src/screenshots/pyqt5-exe.png\" alt=\"PyQt6 exe\" width=213px\u003e\u003c/a\u003e | \u003ca href=\"src/09 Qt dark theme\"\u003e\u003cimg src=\"src/screenshots/qt-dark-theme.png\" alt=\"Qt dark theme\" width=180px\u003e\u003c/a\u003e |\n| :--: | :--: | :--: | :--: |\n| \u003ca href=\"src/06 QML Python example\"\u003eQML Python example\u003c/a\u003e | \u003ca href=\"src/07 Qt Text Editor\"\u003eQt Text Editor\u003c/a\u003e | \u003ca href=\"src/08 PyQt6 exe\"\u003ePackaging \u0026 deployment\u003c/a\u003e | \u003ca href=\"src/09 Qt dark theme\"\u003eQt Dark Theme\u003c/a\u003e |\n\n| \u003ca href=\"src/10 QPainter Python example\"\u003e\u003cimg src=\"src/screenshots/qpainter-python-example.png\" alt=\"QPainter Python example\" width=200px\u003e\u003c/a\u003e | \u003ca href=\"src/11 PyQt Thread example\"\u003e\u003cimg src=\"src/screenshots/pyqt-thread-example.png\" alt=\"PyQt Thread example\" width=175px\u003e\u003c/a\u003e | \u003ca href=\"src/12 QTreeView example in Python\"\u003e\u003cimg src=\"src/screenshots/qtreeview-example-in-python.png\" alt=\"QTreeView example in Python\" width=260px\u003e\u003c/a\u003e | \u003ca href=\"src/13 PyQt6 QListView\"\u003e\u003cimg src=\"src/screenshots/pyqt5-qlistview.png\" alt=\"PyQt6 QListView\" width=138px\u003e\u003c/a\u003e |\n| :--: | :--: | :--: | :--: |\n| \u003ca href=\"src/10 QPainter Python example\"\u003eAction Shooter\u003c/a\u003e | \u003ca href=\"src/11 PyQt Thread example\"\u003eChat Client\u003c/a\u003e | \u003ca href=\"src/12 QTreeView example in Python\"\u003eTree Views\u003c/a\u003e | \u003ca href=\"src/13 PyQt6 QListView\"\u003eLists\u003c/a\u003e |\n\n| \u003ca href=\"src/14 QAbstractTableModel example\"\u003e\u003cimg src=\"src/screenshots/qabstracttablemodel-example.png\" alt=\"QAbstractTableModel example\" height=120px\u003e\u003c/a\u003e | \u003ca href=\"src/15 PyQt database example\"\u003e\u003cimg src=\"src/screenshots/pyqt-database-example.png\" alt=\"QAbstractTableModel example\" height=120px\u003e\u003c/a\u003e |\n| :--: | :--: |\n| \u003ca href=\"src/14 QAbstractTableModel example\"\u003eCustom Tables\u003c/a\u003e |  \u003ca href=\"src/15 PyQt database example\"\u003ePyQt database example\u003c/a\u003e |\n\nThese examples are taken from the following book:\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://build-system.fman.io/pyqt6-book\"\u003e\u003cimg src=\"https://build-system.fman.io/static/public/img/pyqt5-book.jpg\" alt=\"PyQt6 book\"\u003e\u003c/a\u003e\n    \u003cbr/\u003e\n    \u003ca href=\"https://build-system.fman.io/pyqt6-book\"\u003ePython and Qt: The Best Parts\u003c/a\u003e\n    \u003cbr/\u003e\n    by Michael Herrmann\n\u003c/p\u003e\n\n## Official PyQt demos\n\nThe [PyQt source archive](https://www.riverbankcomputing.com/software/pyqt/download5) also contains a large number of sample files. You can find them reproduced here in the [`src/pyqt-official`](src/pyqt-official) directory. The easiest way to start them is to follow the [instructions about running examples](#running-the-examples) below, then execute the following commands:\n\n    cd src/pyqt-official/qtdemo\n    python qtdemo.py\n\nThis starts the PyQt example launcher:\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"src/screenshots/pyqt-examples-launcher.png\" alt=\"PyQt Examples launcher\"\u003e\u003c/p\u003e\n\nYou can use it to easily browse and run the official demo applications. The following examples are quite nice for instance:\n\n * Quick / Animation / ColorAnimation\n * Graphics Effects / Lighting and Shadows\n * Desktop / System Tray\n * Desktop / Screenshot\n * Widgets / Tetrix\n\n## Running the examples\n\nRunning the examples is really easy. The only thing you need is [Python 3](https://www.python.org/downloads/).\n\nFirst, download the [ZIP archive of this repository](https://github.com/pyqt/examples/archive/_.zip) and unpack it. Open a command prompt and use `cd` to navigate into the top-level directory of the archive.\n\nCreate a virtual environment via the command:\n\n    python3 -m venv venv\n\nThis creates the folder `venv/` in your current directory. It will contain the necessary libraries for running the examples.\n\nTo activate the virtual environment, use the following command:\n\n```\n# On Windows:\ncall venv\\Scripts\\activate.bat\n# On Mac / Linux:\nsource venv/bin/activate\n```\n\nNow execute the following to install the necessary dependencies:\n\n    pip install -Ur src/requirements.txt\n\nOnce you have done this, use `cd` to navigate to the example you're interested in in the [`src/`](src) folder. For example:\n\n    cd \"src/01 PyQt QLabel\"\n\nYou'll find a `.py` file there, typically `main.py`. You can run it with the command:\n\n    python main.py\n\nPlease note that the virtual environment must still be active for this to work.\n\n## Using PySide\n\nThis repository uses PyQt6 to use Qt from Python. Another, alternative binding is PySide6 (also called \"Qt for Python\"). It is less mature than PyQt6 but has the advantage that you can use it for free in commercial projects.\n\nIf you want to use PySide6 instead of PyQt6, simply replace all mentions of the latter by the former. For instance, in [`src/requirements.txt`](src/requirements.txt), replace `PyQt6` by `PySide6`. Similarly for any code examples: `from PyQt6.QtWidgets ...` becomes `from PySide6.QtWidgets ...` etc.\n\nAlternatively, if you don't want to commit to either of the two bindings at this stage, you can also use [Qt.py](https://github.com/mottosso/Qt.py). This is an abstraction over PySide6 and PyQt6. It loads whichever of the two bindings is available. To use it for the examples presented here, replace all mentions of `PyQt6` by just `Qt`.\n\n## Licensing\n\nExcept where otherwise indicated, you may use the source code of examples 1 - 15 in the [`src/` directory](src) under the terms of the MIT or GPLv3 licenses.\n\nThe official PyQt demos in [`src/pyqt-official`](src/pyqt-official) are [licensed under the GPL](src/pyqt-official/LICENSE).\n\nThe screenshots in this repository may be used under the terms of the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) if you prominently mention and link to [Michael Herrmann's PyQt6 book](https://build-system.fman.io/pyqt6-book). \n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyqt%2Fexamples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyqt%2Fexamples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyqt%2Fexamples/lists"}