Package tdl :: Module event :: Class App |
[frames] | no frames]

# Class App

source code

    object --+
             |
            App

Application framework.

- ev_*: Events are passed to methods based on their Event.type attribute. If an event type is 'KEYDOWN' the ev_KEYDOWN method will be called with the event instance as a parameter.
- key_*: When a key is pressed another method will be called based on the keyname attribute. For example the 'ENTER' keyname will call key_ENTER with the associated KeyDown event as its parameter.
- update: This method is called every loop before making a call to tdl.flush. It is passed a single parameter detailing the time in seconds since the last update (often known as deltaTime.)

Instance Methods
ev_QUIT(self, event) Unless overridden this method raises a SystemExit exception closing the program. | source code
ev_KEYDOWN(self, event) Override this method to handle this event. | source code
ev_KEYUP(self, event) Override this method to handle this event. | source code
ev_MOUSEDOWN(self, event) Override this method to handle this event. | source code
ev_MOUSEUP(self, event) Override this method to handle this event. | source code
ev_MOUSEMOTION(self, event) Override this method to handle this event. | source code
update(self, deltaTime) Override this method to handle per frame logic and drawing. | source code
suspend(self) When called the App will begin to return control to where App.run was called. | source code
run(self) Delegate control over to this App instance. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### update(self, deltaTime) | source code
Override this method to handle per frame logic and drawing. Parameters: `deltaTime` (float) - This parameter tells the amount of time passed since the last call measured in seconds as a floating point number. You can use this variable to make your program frame rate independent.

### suspend(self) | source code
When called the App will begin to return control to where App.run was called. No further events are processed and the App.update method will be called one last time before exiting (unless suspended during a call to App.update.)

### run(self) | source code
Delegate control over to this App instance. This function will process all events and send them to the special methods ev_* and key_*. A call to App.suspend will return the control flow back to where this function is called. And then the App can be run again. But a single App instance can not be run multiple times simultaneously.