No project description provided
Project description
PyEvent: A simple event handling library for python
Getting Started
- Simply Run this Command:
pip install pyevent
- Here are the examples on how to run events and add a listeners:
from signally.event import Event
test_event = Event()
def greet(name, **kwargs):
print(f"Hello, {name}!")
def greet_with_exclamation(name, **kwargs):
print(f"Hello, {name}!!!")
def greet_with_age(name, age, **kwargs):
print(f"Hello, {name}! You are {age} years old.")
@test_event.emittable
def greet_with_decorator(name, **kwargs):
print(f"Hello, {name} from decorator!")
def main():
# Add listeners to the event
test_event.add_listener(greet) # Greet the user
test_event.add_listener(greet_with_exclamation) # Greet with exclamation
test_event.add_listener(greet_with_age) # Greet with age
test_event.add_listener(lambda name, **kwargs: print(f"Hello, {name} from lambda!")) # Greet from lambda
# test_event.emittable(greet_with_decorator) # This should be a decorator and throws error
# Emit the event
test_event.emit(name="John", age=20)
if __name__ == "__main__":
main()
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
signally-0.1.0.tar.gz
(1.5 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 signally-0.1.0.tar.gz.
File metadata
- Download URL: signally-0.1.0.tar.gz
- Upload date:
- Size: 1.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bc0ea712784991c2ee0594730a9fb654ad8468972ede20f5ddf4b9d598e9716
|
|
| MD5 |
f98e032d4f223aff65470793cc31ca88
|
|
| BLAKE2b-256 |
a01e40161b442aabfdcfbbf9e2206e3db2b9c35a18a0dc4a994982d0c838e36b
|
File details
Details for the file signally-0.1.0-py3-none-any.whl.
File metadata
- Download URL: signally-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fcb3bbdb23d956da8632f68a14d0fea7b489e3b8ca87ff621e51e0a51405c74
|
|
| MD5 |
e7dba1d6b744e49c2d5d67b25bbf63b8
|
|
| BLAKE2b-256 |
cf9e51ad2495b6cb83603fd5cb181d98c1a632a9da26e56d8f9aa0ae0db0dd1f
|