The main application class that provides a context manager for curses apps.
The App class handles curses initialization and cleanup, provides an update loop with configurable FPS, and offers lifecycle hooks for application logic.
Method | __enter__ |
Enter the application context and initialize curses. |
Method | __exit__ |
Exit the application context and cleanup curses. |
Method | __init__ |
Initialize the application. |
Method | is |
Check if an exit has been requested. |
Method | on |
Handle entering the application context. |
Method | on |
Handle exiting the application context. |
Method | on |
Handle frame updates. |
Method | request |
Request the application to exit. |
Method | update |
Update the application state and handle input. |
Instance Variable | __is |
Undocumented |
Instance Variable | _fps |
Undocumented |
Instance Variable | _is |
Undocumented |
Instance Variable | _keypad |
Undocumented |
Instance Variable | _screen |
Undocumented |
cursers.ThreadedApp
Enter the application context and initialize curses.
Returns | |
Self | The application instance. |
cursers.ThreadedApp
Exit the application context and cleanup curses.
Parameters | |
*args:object | Exception information (unused). |
cursers.ThreadedApp
Initialize the application.
Parameters | |
fps:int | Target frames per second (default: 30). |
keypad:bool | Whether to enable arrow keys (default: False). |
Handle entering the application context.
Override this method in your subclass to perform initialization tasks when the application starts.
Parameters | |
screen:Screen | The Screen instance for drawing and input handling. |
Handle exiting the application context.
Override this method in your subclass to perform cleanup tasks when the application exits.
Parameters | |
screen:Screen | The Screen instance for drawing and input handling. |
Handle frame updates.
Override this method in your subclass to handle keyboard input and update your application state.
Parameters | |
screen:Screen | The Screen instance for drawing and input handling. |
Request the application to exit.
Sets the exit flag to True, which will cause the application to exit on the next update cycle.