You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With `qasync`, you can use `asyncio` functionalities directly inside Qt app's event loop, in the main thread. Using async functions for Python tasks can be much easier and cleaner than using `threading.Thread` or `QThread`.
15
15
16
-
If you need some CPU-intensive tasks to be executed in parallel, `qasync` also got that covered, providing `QEventLoop.run_in_executor` which is functionally identical to that of `asyncio`.
16
+
If you need some CPU-intensive tasks to be executed in parallel, `qasync` also got that covered, providing `QEventLoop.run_in_executor` which is functionally identical to that of `asyncio`. By default `QThreadExecutor` is used, but any class implementing the `concurrent.futures.Executor` interface will do the job.
17
17
18
18
### Basic Example
19
19
20
20
```python
21
-
import sys
22
21
import asyncio
22
+
import sys
23
+
24
+
from PySide6.QtWidgets import QVBoxLayout, QWidget
25
+
26
+
from qasync import QApplication, QEventLoop
23
27
24
-
from qasync import QEventLoop, QApplication
25
-
from PySide6.QtWidgets import QWidget, QVBoxLayout
26
28
27
29
classMainWindow(QWidget):
28
30
def__init__(self):
@@ -67,7 +69,7 @@ More detailed examples can be found [here](https://github.com/CabbageDevelopment
0 commit comments