Skip to main content

Use event handler simply.

Project description


pyeventlib library is used to handle event in a simple way.


pip install pyeventlib


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

def event_a(sender):
    print("Event A Sender: " + sender)

async def event_b(sender):
    print("Event C Sender: " + sender)
event1 += event_b

def close_event(sender, e):
    e.accept = True


Copyright 2023. DuelitDev all rights reserved.


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 hashes)

Uploaded py3

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