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

Module event

source code

This module handles user input.

To handle user input you will likely want to use the event.get function or create a subclass of event.App.

But there are other options such as event.keyWait and event.isWindowClosed.

A few event attributes are actually string constants. Here's a reference for those:

Classes
  Event
  Quit
Fired when the window is closed by the user.
  KeyEvent
  KeyDown
Fired when the user presses a key on the keyboard or a key repeats.
  KeyUp
Fired when the user releases a key on the keyboard.
  MouseButtonEvent
  MouseDown
Fired when a mouse button is pressed.
  MouseUp
Fired when a mouse button is released.
  MouseMotion
Fired when the mouse is moved.
  App
Application framework.
Functions
iterator
get()
Flushes the event queue and returns the list of events.
source code
 
push(event)
Push an event into the event buffer.
source code
KeyDown
keyWait()
Waits until the user presses a key.
source code
boolean
isWindowClosed()
Returns True if the exit button on the window has been clicked and stays True afterwards.
source code
Function Details

get()

source code 

Flushes the event queue and returns the list of events.

This function returns Event objects that can be indentified by their type attribute or their class.

Returns: iterator

push(event)

source code 

Push an event into the event buffer.

Parameters:
  • event (Event-like object) - The event will be available on the next call to event.get. An event pushed in the middle of a get will not show until the next time it's called. This prevents infinite loops.

keyWait()

source code 

Waits until the user presses a key. Then returns a KeyDown event.

Returns: KeyDown