wijjit.core.event_loop.EventLoop
- class wijjit.core.event_loop.EventLoop(app, executor=None)[source]
Main event loop for Wijjit applications.
The event loop handles: - Input reading from keyboard and mouse - Terminal resize detection - Animation frame advancement - Notification expiry checks - Event dispatching to handlers - Rendering orchestration
- Parameters:
app (
Wijjit) – Reference to the main applicationexecutor (
ThreadPoolExecutor, optional) – Thread pool for running sync handlers off the event loop thread. If None, sync handlers run directly on the event loop (blocking).
- Variables:
- __init__(app, executor=None)[source]
Initialize the event loop.
- Parameters:
app (
Wijjit) – Reference to the main applicationexecutor (
ThreadPoolExecutor, optional) – Thread pool for running sync handlers. If None, sync handlers run directly on event loop thread (may block).
- Return type:
None
Methods
__init__(app[, executor])Initialize the event loop.
run()Run the main event loop.
Run the main async event loop.
stop()Stop the event loop.
- run()[source]
Run the main event loop.
This is the entry point for the application. It wraps the async event loop for backward compatibility with synchronous code.
The loop continues until quit() is called or the user presses Ctrl+C.
- Raises:
RuntimeError – If no views are registered
- Return type:
None
- async run_async()[source]
Run the main async event loop.
This method enters the main event loop which: 1. Renders initial view 2. Loops: read input -> dispatch events -> re-render if needed 3. Exits on quit() or Ctrl+C
The loop continues until quit() is called or the user presses Ctrl+C.
- Raises:
RuntimeError – If no views are registered
- Return type:
None