events module provides a centralized event system for communication between components.
Events Class
Manages event subscriptions, emissions, and scheduling.Methods
enable()
connect()
str
Name of the event to subscribe to
callable
Callback function to execute when event is emitted
disconnect()
str
Name of the event
callable
The callback function to remove
emit()
str
Name of the event to emit
tuple
Positional arguments passed to callbacks
dict
Keyword arguments passed to callbacks
emit_main_thread()
Use this method when emitting events from background threads to ensure thread safety.
schedule()
float
Delay in seconds before executing callback
callable
Function to execute
tuple
Arguments to pass to callback
bool
default:false
Whether to repeat the callback periodically
int
Unique identifier for the scheduled event
cancel_scheduled()
int
The event ID returned by schedule()
process_thread_events()
bool
Whether the main loop should continue processing
Available Events
General Events
event
Application startup
event
Application shutdown
event
Initial setup/configuration screen
Server Events
event
Server login success or failure
event
Disconnected from server
event
Reconnecting to server
User Events
event
User status changed (online/away/offline)
event
User statistics updated
event
User country code determined
Chat Events
event
Message in chat room
event
Private message sent/received
event
Joined a chat room
event
Left a chat room
Search Events
event
New search started
event
Search results received
Transfer Events
event
Download updated
event
Upload updated
event
Download progress update
event
Upload progress update
Global Instance
events instance is available for import.