| Home | Trees | Index | Help |
|---|
| Package pygsear :: Module 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
|
MODIFIERS
|
MOUSEBUTTON
|
TIMEOUT
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.0 on Fri Nov 11 14:26:38 2005 | http://epydoc.sf.net |