Skip to main content

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

MIT License

Project details


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

pyeventlib-1.1.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pyeventlib-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyeventlib-1.1.2-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

Hashes for pyeventlib-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c6c41a4cca224ed8f6564c339e7aee74c85c9ae36fec7b02fd3597a3cd0066
MD5 2755db897f7e882342d572c56471c319
BLAKE2b-256 613bababc6e028da43857fc29eda36dcfa61ab960c9a1f6edb234532da4e42e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page