Use event handler simply.
Project description
pyeventlib
pyeventlib library is used to handle event in a simple way.
Install
pip install pyeventlib
Examples
import asyncio
from pyeventlib import *
class CloseEventArgs(EventArgs):
def __init__(self):
self.accept = False
# other option
# CloseEventArgs = EventArgs.create(
# "CloseEventArgs",
# {"accept": False})
event1 = EventHandler()
event2 = EventHandler()
async def main():
await event1(__name__)
args = CloseEventArgs()
await event2(__name__, args)
print(args.accept) # True
@event1.register
def event_a(sender):
print("Event A Sender: " + sender)
async def event_b(sender):
print("Event C Sender: " + sender)
event1 += event_b
@event2.register
def close_event(sender, e):
e.accept = True
asyncio.run(main())
Copyright
Copyright 2023. DuelitDev all rights reserved.
License
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file pyeventlib-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyeventlib-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a30e37a52de0bc6a5ac9d9997bd3ed66775bb9cb87dbfa80d900216fd96270a6 |
|
MD5 | a14354b4b7996d49e304c92bdb31ddba |
|
BLAKE2b-256 | 194d4a8e4374b9e358f8832aa011a28451b6659ef4fe4c16dc7d23e2683e1bf0 |