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(text)
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.0.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.0.tar.gz.
File metadata
- Download URL: AsyncioPySide6-0.3.0.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 |
b0217d79bffe806acc73a622008be5890abb58a1cc62c5530cfc3b625567d8ea
|
|
| MD5 |
bd551c2088ce29fa37cabdbf5a4c2aa4
|
|
| BLAKE2b-256 |
1b23a26c0eb79918825245df3964ab49b19d8f01881104c4766ac3b2d2602595
|
File details
Details for the file AsyncioPySide6-0.3.0-py3-none-any.whl.
File metadata
- Download URL: AsyncioPySide6-0.3.0-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 |
f22bd81aa7b7c9e74fdbeaeebb7574960d934b446e1cb472617d235d2b34944b
|
|
| MD5 |
af071bfd8bfca45453fc8afcba604b6c
|
|
| BLAKE2b-256 |
febf15191c9f83f87721c7803a075e2d13e23e506499adf6e6f8c94d0b8aded5
|