diff --git a/README.md b/README.md
index d935e91..733e83f 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,18 @@
-# PyQt examples 2021
+# PyQt examples 2022
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](#running-the-examples).
-|
|
|
|
|
|
+|
|
|
|
|
|
| :--: | :--: | :--: | :--: | :--: |
-| Hello World! | Common PyQt Widgets | Layouts | Signals and Slots | Qt Designer & Python |
+| Hello World! | Common PyQt Widgets | Layouts | Signals and Slots | Qt Designer & Python |
-|
|
|
|
|
+|
|
|
|
|
| :--: | :--: | :--: | :--: |
-| QML Python example | Qt Text Editor | Packaging & deployment | Qt Dark Theme |
+| QML Python example | Qt Text Editor | Packaging & deployment | Qt Dark Theme |
-|
|
|
|
|
+|
|
|
|
|
| :--: | :--: | :--: | :--: |
-| Action Shooter | Chat Client | Tree Views | Lists |
+| Action Shooter | Chat Client | Tree Views | Lists |
|
|
|
| :--: | :--: |
@@ -21,9 +21,9 @@ These PyQt examples show you how to create a desktop app with Python and Qt. Sta
These examples are taken from the following book:
-
+
- Python and Qt: The Best Parts
+ Python and Qt: The Best Parts
by Michael Herrmann
@@ -82,13 +82,13 @@ You'll find a `.py` file there, typically `main.py`. You can run it with the com
Please note that the virtual environment must still be active for this to work.
-## Using PySide2
+## Using PySide
-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.
+This 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.
-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.
+If 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.
-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`.
+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 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`.
## Licensing
@@ -96,4 +96,4 @@ Except where otherwise indicated, you may use the source code of examples 1 - 15
The official PyQt demos in [`src/pyqt-official`](src/pyqt-official) are [licensed under the GPL](src/pyqt-official/LICENSE).
-The 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 PyQt5 book](https://build-system.fman.io/pyqt5-book).
+The 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).
diff --git a/src/01 PyQt QLabel/README.md b/src/01 PyQt QLabel/README.md
index ca56f98..9029988 100644
--- a/src/01 PyQt QLabel/README.md
+++ b/src/01 PyQt QLabel/README.md
@@ -5,18 +5,18 @@ This example shows how you can create a Hello World app using PyQt. It uses a [`

```
-from PyQt5.QtWidgets import *
+from PyQt6.QtWidgets import *
app = QApplication([])
label = QLabel('Hello World!')
label.show()
-app.exec_()
+app.exec()
```
For instructions how you can run this code, please see the [top-level README](../../README.md#running-the-examples).
The code works as follows: First, we import the necessary PyQt classes via the statement:
- from PyQt5.QtWidgets import *
+ from PyQt6.QtWidgets import *
Next, we create a [`QApplication`](https://doc.qt.io/Qt-5/qapplication.html). This is required in every PyQt app. In a sense, it initializes PyQt:
@@ -32,7 +32,7 @@ By calling `.show()` on a [widget](../02%20PyQt%20Widgets), we can spawn a windo
Finally, we hand control over to Qt:
- app.exec_()
+ app.exec()
This too is required in every Qt application. It gives Qt a chance to run and process user input, such as for instance when the user clicks the "Window close" button.
diff --git a/src/01 PyQt QLabel/main.py b/src/01 PyQt QLabel/main.py
index 3802416..55df3c9 100644
--- a/src/01 PyQt QLabel/main.py
+++ b/src/01 PyQt QLabel/main.py
@@ -1,5 +1,5 @@
-from PyQt5.QtWidgets import *
+from PyQt6.QtWidgets import *
app = QApplication([])
label = QLabel('Hello World!')
label.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/02 PyQt Widgets/main.py b/src/02 PyQt Widgets/main.py
index 825b713..d1dcd98 100644
--- a/src/02 PyQt Widgets/main.py
+++ b/src/02 PyQt Widgets/main.py
@@ -42,8 +42,8 @@
#############################################################################
-from PyQt5.QtCore import QDateTime, Qt, QTimer
-from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox, QDateTimeEdit,
+from PyQt6.QtCore import QDateTime, Qt, QTimer
+from PyQt6.QtWidgets import (QApplication, QCheckBox, QComboBox, QDateTimeEdit,
QDial, QDialog, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit,
QProgressBar, QPushButton, QRadioButton, QScrollBar, QSizePolicy,
QSlider, QSpinBox, QStyleFactory, QTableWidget, QTabWidget, QTextEdit,
@@ -240,4 +240,4 @@ if __name__ == '__main__':
app = QApplication(sys.argv)
gallery = WidgetGallery()
gallery.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec())
diff --git a/src/03 QVBoxLayout PyQt5/README.md b/src/03 QVBoxLayout PyQt5/README.md
index 3e98be1..0485561 100644
--- a/src/03 QVBoxLayout PyQt5/README.md
+++ b/src/03 QVBoxLayout PyQt5/README.md
@@ -1,12 +1,12 @@
-# QVBoxLayout PyQt5
+# QVBoxLayout PyQt6
Layouts let you position GUI elements next to each other. [`QVBoxLayout`](https://doc.qt.io/qt-5/qvboxlayout.html) for instance arranges items vertically:
-
+
-The [source code for this example](main.py) is not much more complex than for our [Hello World app](../01%20PyQt%20QLabel). First, we import PyQt5:
+The [source code for this example](main.py) is not much more complex than for our [Hello World app](../01%20PyQt%20QLabel). First, we import PyQt6:
- from PyQt5.QtWidgets import *
+ from PyQt6.QtWidgets import *
Then, we create the required `QApplication`:
@@ -34,7 +34,7 @@ Finally, we add the layout - and thus its contents - to the `window` we created
We conclude by showing the window and (as is required) handing control over to Qt:
window.show()
- app.exec_()
+ app.exec()
For instructions how you can run this example yourself, please see [here](../../README.md#running-the-examples).
diff --git a/src/03 QVBoxLayout PyQt5/main.py b/src/03 QVBoxLayout PyQt5/main.py
index b5550a4..9f9adc2 100644
--- a/src/03 QVBoxLayout PyQt5/main.py
+++ b/src/03 QVBoxLayout PyQt5/main.py
@@ -1,4 +1,4 @@
-from PyQt5.QtWidgets import *
+from PyQt6.QtWidgets import *
app = QApplication([])
window = QWidget()
layout = QVBoxLayout()
@@ -6,4 +6,4 @@ layout.addWidget(QPushButton('Top'))
layout.addWidget(QPushButton('Bottom'))
window.setLayout(layout)
window.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/04 PyQt Signals and Slots/README.md b/src/04 PyQt Signals and Slots/README.md
index 8cd64ab..b647773 100644
--- a/src/04 PyQt Signals and Slots/README.md
+++ b/src/04 PyQt Signals and Slots/README.md
@@ -4,9 +4,9 @@ PyQt Signals let you react to user input such as mouse clicks. A *slot* is a fun

-The code begins in the usual way. First, we import PyQt5 and create a `QApplication`:
+The code begins in the usual way. First, we import PyQt6 and create a `QApplication`:
- from PyQt5.QtWidgets import *
+ from PyQt6.QtWidgets import *
app = QApplication([])
Next, we create a button:
@@ -18,7 +18,7 @@ Then we define a function. It will be called when the user clicks the button. Yo
def on_button_clicked():
alert = QMessageBox()
alert.setText('You clicked the button!')
- alert.exec_()
+ alert.exec()
And here is where signals and slots come into play: We instruct Qt to invoke our function by _connecting_ it to the `.clicked` signal of our button:
@@ -27,6 +27,6 @@ And here is where signals and slots come into play: We instruct Qt to invoke our
Finally, we show the button on the screen and hand control over to Qt:
button.show()
- app.exec_()
+ app.exec()
For instructions how you can run this example yourself, please see [here](../../README.md#running-the-examples).
diff --git a/src/04 PyQt Signals and Slots/main.py b/src/04 PyQt Signals and Slots/main.py
index 279b349..95ddebb 100644
--- a/src/04 PyQt Signals and Slots/main.py
+++ b/src/04 PyQt Signals and Slots/main.py
@@ -1,4 +1,4 @@
-from PyQt5.QtWidgets import *
+from PyQt6.QtWidgets import *
app = QApplication([])
button = QPushButton('Click')
@@ -6,8 +6,8 @@ button = QPushButton('Click')
def on_button_clicked():
alert = QMessageBox()
alert.setText('You clicked the button!')
- alert.exec_()
+ alert.exec()
button.clicked.connect(on_button_clicked)
button.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/05 Qt Designer Python/README.md b/src/05 Qt Designer Python/README.md
index 1266030..9ecaced 100644
--- a/src/05 Qt Designer Python/README.md
+++ b/src/05 Qt Designer Python/README.md
@@ -12,15 +12,15 @@ The dialog in the following screenshot comes from the file [`dialog.ui`](dialog.
The [`main.py`](main.py) script (also in this directory) loads and invokes `dialog.ui` from Python. The steps with which it does this are quite easy.
-First, [`main.py`](main.py) imports the `uic` module from PyQt5:
+First, [`main.py`](main.py) imports the `uic` module from PyQt6:
- from PyQt5 import uic
+ from PyQt6 import uic
It also imports `QApplication`. Like all (Py)Qt apps, we must create an instance of this class.
- from PyQt5.QtWidgets import QApplication
+ from PyQt6.QtWidgets import QApplication
-Then, we use [`uic.loadUiType(...)`](https://www.riverbankcomputing.com/static/Docs/PyQt5/designer.html#PyQt5.uic.loadUiType) to load the `.ui` file. This returns two classes, which we call `Form` and `Window`:
+Then, we use [`uic.loadUiType(...)`](https://www.riverbankcomputing.com/static/Docs/PyQt6/designer.html#PyQt6.uic.loadUiType) to load the `.ui` file. This returns two classes, which we call `Form` and `Window`:
Form, Window = uic.loadUiType("dialog.ui")
@@ -42,6 +42,6 @@ Next, we instantiate the `Form`. We invoke its `.setupUi(...)` method, passing t
We've now connected the necessary components for displaying the user interface given in the `.ui` file. All that remains is to `.show()` the window and kick off Qt's event processing mechanism:
window.show()
- app.exec_()
+ app.exec()
For instructions how to run this example yourself, please see [here](../../README.md#running-the-examples).
diff --git a/src/05 Qt Designer Python/main.py b/src/05 Qt Designer Python/main.py
index 7626b78..2a5b215 100644
--- a/src/05 Qt Designer Python/main.py
+++ b/src/05 Qt Designer Python/main.py
@@ -1,5 +1,5 @@
-from PyQt5 import uic
-from PyQt5.QtWidgets import QApplication
+from PyQt6 import uic
+from PyQt6.QtWidgets import QApplication
Form, Window = uic.loadUiType("dialog.ui")
@@ -8,4 +8,4 @@ window = Window()
form = Form()
form.setupUi(window)
window.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/06 QML Python example/README.md b/src/06 QML Python example/README.md
index 37ef628..3242109 100644
--- a/src/06 QML Python example/README.md
+++ b/src/06 QML Python example/README.md
@@ -44,13 +44,13 @@ Window {
Executing the QML from Python is even easier. The code is in [`main.py`](main.py):
```
-from PyQt5.QtQml import QQmlApplicationEngine
-from PyQt5.QtWidgets import QApplication
+from PyQt6.QtQml import QQmlApplicationEngine
+from PyQt6.QtWidgets import QApplication
app = QApplication([])
engine = QQmlApplicationEngine()
engine.load("main.qml")
-app.exec_()
+app.exec()
```
If you'd like further instructions how you can run this code for yourself, please see [here](../../README.md#running-the-examples).
diff --git a/src/06 QML Python example/main.py b/src/06 QML Python example/main.py
index bb25aea..6e47e82 100644
--- a/src/06 QML Python example/main.py
+++ b/src/06 QML Python example/main.py
@@ -1,7 +1,7 @@
-from PyQt5.QtQml import QQmlApplicationEngine
-from PyQt5.QtWidgets import QApplication
+from PyQt6.QtQml import QQmlApplicationEngine
+from PyQt6.QtWidgets import QApplication
app = QApplication([])
engine = QQmlApplicationEngine()
engine.load("main.qml")
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/07 Qt Text Editor/main.py b/src/07 Qt Text Editor/main.py
index 162874b..c841dce 100644
--- a/src/07 Qt Text Editor/main.py
+++ b/src/07 Qt Text Editor/main.py
@@ -1,5 +1,5 @@
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import QKeySequence
+from PyQt6.QtWidgets import *
+from PyQt6.QtGui import QKeySequence
class MainWindow(QMainWindow):
def closeEvent(self, e):
@@ -81,4 +81,4 @@ def show_about_dialog():
about_action.triggered.connect(show_about_dialog)
window.show()
-app.exec_()
+app.exec()
diff --git a/src/08 PyQt5 exe/README.md b/src/08 PyQt5 exe/README.md
index 119cb28..a8b0cb8 100644
--- a/src/08 PyQt5 exe/README.md
+++ b/src/08 PyQt5 exe/README.md
@@ -1,16 +1,16 @@
-# PyQt5 exe
+# PyQt6 exe
-Once you have a PyQt5 application, you want to compile your Python source code into a standalone executable. Furthermore, you normally want to create an installer so your users can easily set up your app.
+Once you have a PyQt6 application, you want to compile your Python source code into a standalone executable. Furthermore, you normally want to create an installer so your users can easily set up your app.
This example uses [fbs](https://build-system.fman.io) to create a standalone executable and an installer for the text editor in [example 07](../07%20Qt%20Text%20Editor).
-
+
You can find a modified version of the ["old" main.py](../07%20Qt%20Text%20Editor/main.py) in [`src/main/python/main.py`](src/main/python/main.py). It only has a few extra lines:
We import fbs's `ApplicationContext`:
- from fbs_runtime.application_context.PyQt5 import ApplicationContext
+ from fbs_runtime.application_context.PyQt6 import ApplicationContext
Further down, we instantiate it:
@@ -34,9 +34,9 @@ To handle this, the new code uses fbs's [`ApplicationContext.get_resource(...)`]
This automatically handles the different possible locations of the image.
-Because we didn't create the `QApplication` ourselves, we finally use the following call instead of only `app.exec_()`:
+Because we didn't create the `QApplication` ourselves, we finally use the following call instead of only `app.exec()`:
- appctxt.app.exec_()
+ appctxt.app.exec()
To run this example yourself, you need fbs installed as per the instructions [here](../../README.md#running-the-examples). Then, you can do use the following command to run the text editor:
diff --git a/src/08 PyQt5 exe/src/main/python/main.py b/src/08 PyQt5 exe/src/main/python/main.py
index 048ef86..c07724f 100644
--- a/src/08 PyQt5 exe/src/main/python/main.py
+++ b/src/08 PyQt5 exe/src/main/python/main.py
@@ -1,12 +1,12 @@
-from fbs_runtime.application_context.PyQt5 import ApplicationContext
-from PyQt5.QtWidgets import QMainWindow
+from fbs_runtime.application_context.PyQt6 import ApplicationContext
+from PyQt6.QtWidgets import QMainWindow
import sys
appctxt = ApplicationContext() # 1. Instantiate ApplicationContext
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import QKeySequence
+from PyQt6.QtWidgets import *
+from PyQt6.QtGui import QKeySequence
class MainWindow(QMainWindow):
def closeEvent(self, e):
@@ -80,10 +80,10 @@ def show_about_dialog():
% appctxt.get_resource("icon.svg")
about_dialog = QMessageBox(window)
about_dialog.setText(text)
- about_dialog.exec_()
+ about_dialog.exec()
about_action.triggered.connect(show_about_dialog)
window.show()
-exit_code = appctxt.app.exec_() # 2. Invoke appctxt.app.exec_()
+exit_code = appctxt.app.exec() # 2. Invoke appctxt.app.exec()
sys.exit(exit_code)
diff --git a/src/09 Qt dark theme/main.py b/src/09 Qt dark theme/main.py
index ee1105e..a405db2 100644
--- a/src/09 Qt dark theme/main.py
+++ b/src/09 Qt dark theme/main.py
@@ -1,6 +1,6 @@
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import QKeySequence, QPalette, QColor
-from PyQt5.QtCore import Qt
+from PyQt6.QtWidgets import *
+from PyQt6.QtGui import QKeySequence, QPalette, QColor
+from PyQt6.QtCore import Qt
app = QApplication([])
@@ -102,4 +102,4 @@ def show_about_dialog():
about_action.triggered.connect(show_about_dialog)
window.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/10 QPainter Python example/main.py b/src/10 QPainter Python example/main.py
index 484901e..3144fc1 100644
--- a/src/10 QPainter Python example/main.py
+++ b/src/10 QPainter Python example/main.py
@@ -1,7 +1,7 @@
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5.QtCore import *
-from PyQt5.QtMultimedia import QSound
+from PyQt6.QtWidgets import *
+from PyQt6.QtGui import *
+from PyQt6.QtCore import *
+from PyQt6.QtMultimedia import QSound
class PlainTextEdit(QPlainTextEdit):
def __init__(self):
@@ -100,4 +100,4 @@ def show_about_dialog():
about_action.triggered.connect(show_about_dialog)
window.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/11 PyQt Thread example/01_single_threaded.py b/src/11 PyQt Thread example/01_single_threaded.py
index 7e02378..533674f 100644
--- a/src/11 PyQt Thread example/01_single_threaded.py
+++ b/src/11 PyQt Thread example/01_single_threaded.py
@@ -1,5 +1,5 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
+from PyQt6.QtCore import *
+from PyQt6.QtWidgets import *
from requests import Session
name = input("Please enter your name: ")
@@ -34,4 +34,4 @@ timer = QTimer()
timer.timeout.connect(display_new_messages)
timer.start(1000)
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/11 PyQt Thread example/02_multithreaded.py b/src/11 PyQt Thread example/02_multithreaded.py
index 9bf788f..dcfa85a 100644
--- a/src/11 PyQt Thread example/02_multithreaded.py
+++ b/src/11 PyQt Thread example/02_multithreaded.py
@@ -1,5 +1,5 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
+from PyQt6.QtCore import *
+from PyQt6.QtWidgets import *
from requests import Session
from threading import Thread
from time import sleep
@@ -46,4 +46,4 @@ timer = QTimer()
timer.timeout.connect(display_new_messages)
timer.start(1000)
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/11 PyQt Thread example/03_with_threadutil.py b/src/11 PyQt Thread example/03_with_threadutil.py
index 2d49dc4..69cdd48 100644
--- a/src/11 PyQt Thread example/03_with_threadutil.py
+++ b/src/11 PyQt Thread example/03_with_threadutil.py
@@ -1,5 +1,5 @@
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
+from PyQt6.QtCore import *
+from PyQt6.QtWidgets import *
from requests import Session
from threading import Thread
from threadutil import run_in_main_thread
@@ -40,4 +40,4 @@ message.returnPressed.connect(send_message)
thread = Thread(target=fetch_new_messages, daemon=True)
thread.start()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/11 PyQt Thread example/threadutil.py b/src/11 PyQt Thread example/threadutil.py
index 7a4d3ea..ecb060d 100644
--- a/src/11 PyQt Thread example/threadutil.py
+++ b/src/11 PyQt Thread example/threadutil.py
@@ -1,4 +1,4 @@
-from PyQt5.QtCore import QObject, pyqtSignal
+from PyQt6.QtCore import QObject, pyqtSignal
class CurrentThread(QObject):
diff --git a/src/11 PyQt Thread example/threadutil_blocking.py b/src/11 PyQt Thread example/threadutil_blocking.py
index 716e9f4..c762215 100644
--- a/src/11 PyQt Thread example/threadutil_blocking.py
+++ b/src/11 PyQt Thread example/threadutil_blocking.py
@@ -11,8 +11,8 @@ It allows you to receive results from the function invocation:
"""
from functools import wraps
-from PyQt5.QtCore import pyqtSignal, QObject, QThread
-from PyQt5.QtWidgets import QApplication
+from PyQt6.QtCore import pyqtSignal, QObject, QThread
+from PyQt6.QtWidgets import QApplication
from threading import Event, get_ident
def run_in_thread(thread_fn):
diff --git a/src/12 QTreeView example in Python/README.md b/src/12 QTreeView example in Python/README.md
index 1dbaf6e..a15925b 100644
--- a/src/12 QTreeView example in Python/README.md
+++ b/src/12 QTreeView example in Python/README.md
@@ -1,6 +1,6 @@
# QTreeView example in Python
-A _tree view_ is what's classicaly used to display files and folders: A hierarchical structure where items can be expanded. This example application shows how PyQt5's [`QTreeView`](https://doc.qt.io/qt-5/qtreeview.html) can be used to display your local files.
+A _tree view_ is what's classicaly used to display files and folders: A hierarchical structure where items can be expanded. This example application shows how PyQt6's [`QTreeView`](https://doc.qt.io/qt-5/qtreeview.html) can be used to display your local files.

@@ -18,6 +18,6 @@ The nice thing about the Model/View distinction is that it lets you visualize th
view = QListView()
-The next example, [PyQt5 QListview](../13%20PyQt5%20QListView), shows another way of using `QListView`.
+The next example, [PyQt6 QListview](../13%20PyQt6%20QListView), shows another way of using `QListView`.
To run this example yourself, please follow [the instructions in the README of this repository](../../README.md#running-the-examples).
diff --git a/src/12 QTreeView example in Python/main.py b/src/12 QTreeView example in Python/main.py
index 5b69c15..0fc268a 100644
--- a/src/12 QTreeView example in Python/main.py
+++ b/src/12 QTreeView example in Python/main.py
@@ -1,5 +1,5 @@
from os.path import expanduser
-from PyQt5.QtWidgets import *
+from PyQt6.QtWidgets import *
home_directory = expanduser('~')
@@ -9,4 +9,4 @@ view = QTreeView()
view.setModel(model)
view.setRootIndex(model.index(home_directory))
view.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/13 PyQt5 QListView/README.md b/src/13 PyQt5 QListView/README.md
index 9aea758..9fa18eb 100644
--- a/src/13 PyQt5 QListView/README.md
+++ b/src/13 PyQt5 QListView/README.md
@@ -1,8 +1,8 @@
-# PyQt5 QListView
+# PyQt6 QListView
-This example shows how you can use a PyQt5 [`QListView`](https://doc.qt.io/qt-5/qlistview.html) to display a list.
+This example shows how you can use a PyQt6 [`QListView`](https://doc.qt.io/qt-5/qlistview.html) to display a list.
-
+
It simply shows a static list of strings. Technically, the data is managed by Qt's [`QStringListModel`](https://doc.qt.io/qt-5/qstringlistmodel.html). The important steps of the [code](main.py) are:
diff --git a/src/13 PyQt5 QListView/main.py b/src/13 PyQt5 QListView/main.py
index 3d80515..cdc1bb0 100644
--- a/src/13 PyQt5 QListView/main.py
+++ b/src/13 PyQt5 QListView/main.py
@@ -1,5 +1,5 @@
-from PyQt5.QtWidgets import *
-from PyQt5.QtCore import QStringListModel
+from PyQt6.QtWidgets import *
+from PyQt6.QtCore import QStringListModel
app = QApplication([])
model = QStringListModel([
@@ -8,4 +8,4 @@ model = QStringListModel([
view = QListView()
view.setModel(model)
view.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/14 QAbstractTableModel example/main.py b/src/14 QAbstractTableModel example/main.py
index 5f1edba..f170e9e 100644
--- a/src/14 QAbstractTableModel example/main.py
+++ b/src/14 QAbstractTableModel example/main.py
@@ -1,5 +1,5 @@
-from PyQt5.QtWidgets import *
-from PyQt5.QtCore import *
+from PyQt6.QtWidgets import *
+from PyQt6.QtCore import *
headers = ["Scientist name", "Birthdate", "Contribution"]
rows = [("Newton", "1643-01-04", "Classical mechanics"),
@@ -25,4 +25,4 @@ model = TableModel()
view = QTableView()
view.setModel(model)
view.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/15 PyQt database example/main.py b/src/15 PyQt database example/main.py
index c4cf692..603a9f7 100644
--- a/src/15 PyQt database example/main.py
+++ b/src/15 PyQt database example/main.py
@@ -1,6 +1,6 @@
from os.path import exists
-from PyQt5.QtWidgets import *
-from PyQt5.QtSql import *
+from PyQt6.QtWidgets import *
+from PyQt6.QtSql import *
import sys
@@ -18,4 +18,4 @@ model.select()
view = QTableView()
view.setModel(model)
view.show()
-app.exec_()
\ No newline at end of file
+app.exec()
\ No newline at end of file
diff --git a/src/requirements.txt b/src/requirements.txt
index 40375b9..baa951b 100644
--- a/src/requirements.txt
+++ b/src/requirements.txt
@@ -1,3 +1,3 @@
-fbs==0.8.3
-PyQt5==5.12.3
+fbs
+PyQt6
requests