Simple Event handler with custom objects for tracking realtime data changes
Project description
SimpleEvents
Simple Event Handler and utility objects for monitoring and responding to changes in data structures.
Changelog
0.1.0 Initial Release
- Implemented generic Event() object for event processing
- Implemented EventList(). Custom list with events to respond to adding, removal, and change of entries. And responding to clearing of List.
Installation
pip install eventables
Event() Usage
from eventables.events import Event
class MyObject:
def __init__(self):
self.my_event = Event()
def trigger_example(self):
# do stuff
self.my_event(my_arg="Successful Event Call")
def reaction_function(my_arg):
print(my_arg)
def demo():
my_object = MyObject()
my_object.my_event += reaction_function
my_object.trigger_example()
Output
>>> demo()
Successful Event Call
EventList() Usage
List
from eventables.events import EventList
class MyObject:
def __init__(self):
self.my_list = EventList()
def reaction_function(value):
print(f"Successfully added {value} to list!")
def demo():
my_object = MyObject()
my_object.my_list.on_entry_added += reaction_function
my_object.my_list.append("Test Object")
Output
>>> demo()
Successfully added Test Object to list!
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
eventables-0.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for eventables-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0638c09ba6f03bff41f1cf8de3c49d71666c2d17cb17253792eec09005f4010 |
|
MD5 | 28ef11c7c5e1dbb4e2eef526c1d2213f |
|
BLAKE2b-256 | 3ad052a30c2ac95d9033d405323c4ea4ed1002ae8729c7a65125148acca977af |