Skip to content

Commit a76822c

Browse files
committed
Move repo to github.com/pyqt/examples
1 parent 95594ad commit a76822c

File tree

90 files changed

+2
-2182
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2
-2182
lines changed

README.md

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,3 @@
1-
# PyQt Examples 2019
1+
# PyQt Examples
22

3-
Learn to create desktop apps with Python and Qt. Screenshots on Ubuntu below. You can also use Windows or macOS.
4-
5-
| <a href="src/01 PyQt QLabel"><img src="src/01 PyQt QLabel/pyqt-qlabel.png" alt="PyQt QLabel" width=100px></a> | <a href="src/02 PyQt Widgets"><img src="src/02 PyQt Widgets/pyqt-widgets.png" alt="PyQt widgets screenshot" width=200px></a> | <a href="src/03 QVBoxLayout PyQt5"><img src="src/03 QVBoxLayout PyQt5/qvboxlayout-pyqt5.png" alt="QVBoxLayout PyQt5" width=100px></a> | <a href="src/04 PyQt Signals and Slots"><img src="src/04 PyQt Signals and Slots/pyqt-signals-and-slots.jpg" alt="PyQt Signals and Slots" width=170px></a> | <a href="src/05 Qt Designer Python"><img src="src/05 Qt Designer Python/qt-designer-windows.png" alt="Qt Designer Python" width=190px></a> |
6-
| :--: | :--: | :--: | :--: | :--: |
7-
| <a href="src/01 PyQt QLabel">Hello World!</a> | <a href="src/02 PyQt Widgets">Common PyQt Widgets</a> | <a href="src/03 QVBoxLayout PyQt5">Layouts</a> | <a href="src/04 PyQt Signals and Slots">Signals and Slots</a> | <a href="src/04 Qt Designer Python">Qt Designer & Python</a> |
8-
9-
| <a href="src/06 QML Python example"><img src="src/06 QML Python example/qml-python-example.png" alt="QML Python example" width=200px></a> | <a href="src/07 Qt Text Editor"><img src="src/07 Qt Text Editor/screenshots/qt-text-editor.png" alt="Qt Text Editor" width=180px></a> | <a href="src/08 PyQt5 exe"><img src="src/08 PyQt5 exe/pyqt5-exe.png" alt="PyQt5 exe" width=213px></a> | <a href="src/09 Qt dark theme"><img src="src/09 Qt dark theme/qt-dark-theme.png" alt="Qt dark theme" width=180px></a> |
10-
| :--: | :--: | :--: | :--: |
11-
| <a href="src/06 QML Python example">QML Python example</a> | <a href="src/07 Qt Text Editor">Qt Text Editor</a> | <a href="src/08 PyQt5 exe">Packaging & deployment</a> | <a href="src/09 Qt dark theme">Qt Dark Theme</a> |
12-
13-
| <a href="src/10 QPainter Python example"><img src="src/10 QPainter Python example/qpainter-python-example.png" alt="QPainter Python example" width=200px></a> | <a href="src/11 PyQt Thread example"><img src="src/11 PyQt Thread example/pyqt-thread-example.png" alt="PyQt Thread example" width=175px></a> | <a href="src/12 QTreeView example in Python"><img src="src/12 QTreeView example in Python/qtreeview-example-in-python.png" alt="QTreeView example in Python" width=260px></a> | <a href="src/13 PyQt5 QListView"><img src="src/13 PyQt5 QListView/pyqt5-qlistview.png" alt="PyQt5 QListView" width=138px></a> |
14-
| :--: | :--: | :--: | :--: |
15-
| <a href="src/10 QPainter Python example">Action Shooter</a> | <a href="src/11 PyQt Thread example">Chat Client</a> | <a href="src/12 QTreeView example in Python">Tree Views</a> | <a href="src/13 PyQt5 QListView">Lists</a> |
16-
17-
| <a href="src/14 QAbstractTableModel example"><img src="src/14 QAbstractTableModel example/qabstracttablemodel-example.png" alt="QAbstractTableModel example" height=120px></a> | <a href="src/15 PyQt database example"><img src="src/15 PyQt database example/pyqt-database-example.png" alt="QAbstractTableModel example" height=120px></a> |
18-
| :--: | :--: |
19-
| <a href="src/14 QAbstractTableModel example">Custom Tables</a> | <a href="src/15 PyQt database example">PyQt database example</a> |
20-
21-
## Running the examples
22-
23-
Running the examples is really easy. The only thing you need is [Python 3](https://www.python.org/downloads/).
24-
25-
First, download the [ZIP archive of this repository](https://github.com/1mh/pyqt-examples/archive/_.zip) and unpack it. Open a command prompt and use `cd` to navigate into the top-level directory of the archive.
26-
27-
Create a virtual environment via the command:
28-
29-
python3 -m venv venv
30-
31-
This creates the folder `venv/` in your current directory. It will contain the necessary libraries for running the examples.
32-
33-
To activate the virtual environment, use the following command:
34-
35-
```
36-
# On Windows:
37-
call venv\Scripts\actviate.bat
38-
# On Mac / Linux:
39-
source venv/bin/activate
40-
```
41-
42-
Now execute the following to install the necessary dependencies:
43-
44-
pip install -Ur src/requirements.txt
45-
46-
Once you have done this, use `cd` to navigate to the example you're interested in in the [`src/`](src) folder. For example:
47-
48-
cd "src/01 PyQt QLabel"
49-
50-
You'll find a `.py` file there, typically `main.py`. You can run it with the command:
51-
52-
python main.py
53-
54-
Please note that the virtual environment must still be active for this to work.
55-
56-
## Using PySide2
57-
58-
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.
59-
60-
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`](src/requirements.txt), replace `PyQt5` by `PySide2`. Similarly for any code examples: `from PyQt5.QtWidgets ...` becomes `from PySide2.QtWidgets ...` etc.
61-
62-
Alternatively, 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 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`.
63-
64-
## License
65-
66-
Except where otherwise indicated, the contents here are © me, Michael Herrmann. I'm happy for you to use the source code under the terms of the MIT license. The screenshots may be used under the terms of the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
3+
The contents of this repository have been moved to https://github.com/pyqt/examples.

src/.gitignore

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/01 PyQt QLabel/README.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/01 PyQt QLabel/main.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/01 PyQt QLabel/pyqt-qlabel.png

-4 KB
Binary file not shown.

src/02 PyQt Widgets/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)