class documentation

class ThreadedApp(App, Thread):

Constructor: ThreadedApp(fps, keypad)

View In Hierarchy

Extends App to run the update loop in a separate thread.

This class combines the functionality of App and Thread to provide a threaded application that runs the update loop automatically in the background.

Method __enter__ Enter the application context and start the thread.
Method __exit__ Exit the application context and join the thread.
Method __init__ Initialize the threaded application.
Method run Run the update loop in the thread.

Inherited from App:

Method is_exit_requested Check if an exit has been requested.
Method on_enter Handle entering the application context.
Method on_exit Handle exiting the application context.
Method on_update Handle frame updates.
Method request_exit Request the application to exit.
Method update Update the application state and handle input.
Instance Variable __is_exit_requested Undocumented
Instance Variable _fps Undocumented
Instance Variable _is_exit_requested Undocumented
Instance Variable _keypad Undocumented
Instance Variable _screen Undocumented

Inherited from Thread (via App):

Instance Variable _thread Undocumented
def __enter__(self) -> Self:

Enter the application context and start the thread.

Returns
SelfThe threaded application instance.
def __exit__(self, *args: object):

Exit the application context and join the thread.

Parameters
*args:objectException information (unused).
def __init__(self, *, fps: int = 30, keypad: bool = False):

Initialize the threaded application.

Parameters
fps:intTarget frames per second (default: 30).
keypad:boolWhether to enable arrow keys (default: False).
def run(self):

Run the update loop in the thread.

This method is called automatically when the thread starts. It continuously calls update() while the application is running.