No project description provided
Project description
AsyncioPySide6
Empower Qt PySide6 developers with seamless async/await asynchronous programming capabilities
Installation:
pip install AsyncioPySide6
Example:
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QLabel
from AsyncioPySide6 import AsyncioPySide6
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
# Execute an asynchronous task
AsyncioPySide6.runTask(self.calculate_async(20))
def init_ui(self):
"""Initialize GUI"""
self.label = QLabel("Calculating...")
self.setCentralWidget(self.label)
async def calculate_async(self, n:int):
"""Asynchronous method that does a time-expensive calculation"""
# Give Qt sometime to show the window
await asyncio.sleep(0.5)
# Calculate
sum = 0
for i in range(n):
# Create some delay
await asyncio.sleep(0.1)
sum = sum + i
self.label.setText(f"SUM([0..{i}]) = {sum}")
if __name__ == "__main__":
app = QApplication(sys.argv)
with AsyncioPySide6.use_asyncio():
main_window = MainWindow()
main_window.show()
app.exec()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
AsyncioPySide6-0.3.2.tar.gz
(4.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file AsyncioPySide6-0.3.2.tar.gz.
File metadata
- Download URL: AsyncioPySide6-0.3.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eac96d80bd9aace6787fba50e5a91e1bc5cf46bc0209c2d4d34e6cc0e46eaae
|
|
| MD5 |
854b925ac6c63eef625aa27c1d59d7a3
|
|
| BLAKE2b-256 |
06eabf8fa58596b4a0fb025aabc5ac8b90775527c9fd3ce176658ead861bc223
|
File details
Details for the file AsyncioPySide6-0.3.2-py3-none-any.whl.
File metadata
- Download URL: AsyncioPySide6-0.3.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
504d6e114250a04503b38ef19921912f2fc54992bdd4a5263428c31c972dc4a1
|
|
| MD5 |
f4917ac0ed4d6cad611a2f9731376244
|
|
| BLAKE2b-256 |
a48bc8edd217c02dbe17d0eaa2cd2cf7d107d69c11b144babd4aae023cb6fb03
|