Signal for Python
Project description
Thread Safe Signal
Thread safe signal to generate and receive events
Installation:
pip install pyrvsignal
Example code:
import time
from threading import Thread
from pyrvsignal import Signal
class MyThread(Thread):
started = Signal()
finished = Signal()
def __init__(self, target, args):
self.target = target
self.args = args
Thread.__init__(self)
def run(self) -> None:
self.started.emit()
self.target(*self.args)
self.finished.emit()
def do_my_work(details):
print(f"Doing work: {details}")
time.sleep(10)
def started_work():
print("Started work")
def finished_work():
print("Work finished")
thread = MyThread(target=do_my_work, args=("testing",))
thread.started.connect(started_work)
thread.finished.connect(finished_work)
thread.start()
Contact
If any suggestions mail to ravikiranb36@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyrvsignal-2023.8.1.tar.gz
(2.1 kB
view details)
File details
Details for the file pyrvsignal-2023.8.1.tar.gz
.
File metadata
- Download URL: pyrvsignal-2023.8.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8626fda2c6df86af98c6d30f4f0d15a1b3ff08d4e1f7030b9d18d6e57c0eaff7 |
|
MD5 | eb718e13a492340dc65f531705bb9396 |
|
BLAKE2b-256 | 31042e91a94ed0b24008ca5f8fd98fe6e3676e76a3beceecad6954eee928dd46 |