Package pygsear :: Module Event
[show private | hide private]
[frames | no frames]

Module pygsear.Event

Keyboard and mouse event handling.

This module is used to create objects that relate raw pygame events (keys being pressed on the keyboard, mouse buttons being clicked, the pygame window being closed, joystick movement (incomplete)) with other object methods and functions.

For instance, in your game you may want to use a control where every time the up arrow is pressed on the keyboard, your player's ship starts to accelerate. That might look something like:
   class Ship:
       def initialize(self):
           self.events.add(Event.KEYDOWN_Event(key=K_UP, callback=self.accel))
Actually controlling the ship is a bit more complicated than this, since you probably want the player to be able to hold down the arrow to keep on accelerating. See some of the examples for more ideas on how to do that.
Classes
Event Relates Pygame Events with related actions.
EventGroup Used to group related events.
KEY_Event Keyboard events.
KEYDOWN_Event  
KEYUP_Event  
MOUSEBUTTON_Event Mouse button events.
MOUSEBUTTONDOWN_Event  
MOUSEBUTTONUP_Event  
QUIT_Event  
Repeat_KEY_Event KEY_Event which will auto-repeat after a delay.
TIMEOUT_Event  

Variable Summary
int KEY = -2                                                                    
list MODIFIERS = [304, 303, 306, 305, 308, 307]
int MOUSEBUTTON = -4                                                                    
int TIMEOUT = -1                                                                    

Variable Details

KEY

Type:
int
Value:
-2                                                                    

MODIFIERS

Type:
list
Value:
[304, 303, 306, 305, 308, 307]                                         

MOUSEBUTTON

Type:
int
Value:
-4                                                                    

TIMEOUT

Type:
int
Value:
-1                                                                    

Generated by Epydoc 2.0 on Sat Dec 9 14:11:20 2006 http://epydoc.sf.net