import os
import sys
import pygame
from pygame import *
def main():
pygame.init()
ecran = pygame.display.set_mode((640, 480))
ruleaza= True
action = "Help!"
while ruleaza is True:
for event in pygame.event.get():
if event.type == QUIT:
ruleaza == False
elif event.type == KEYDOWN:
if event.key == K_ESCAPE:
ruleaza = False
elif event.key == K_LEFT:
action="L"
elif event.key == K_RIGHT:
action="R"
print action
main()
Python and Pygame tutorials with source code, examples, guides, and tips and tricks for Windows and Linux development.
marți, 17 februarie 2009
PyGame : Keyboard on pygame
This is a short example of how to use the keyboard in pygame.
Posted by
Cătălin George Feștilă
Labels:
2009,
pygame,
python,
python module,
source code,
tutorial,
tutorials
Abonați-vă la:
Comentarii (Atom)