added a new module that creates a sdl window and gets a key from the user

this can be used so that hotkeys and input can be controlled from the GUI
directly

this module however adds an additional depenency to the program: pygame

i might just rewrite this in c so gfceu doesn't have another dependency
This commit is contained in:
punkrockguy318 2008-06-28 19:13:37 +00:00
parent ac2abd91f1
commit 2db6590fbd
1 changed files with 17 additions and 0 deletions

17
get_key.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
import pygame
import sys
from pygame.locals import *
pygame.init()
width = 300
height = 100
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("Press any key. . .")
while 1:
for event in pygame.event.get():
if event.type == KEYDOWN:
print event.key
sys.exit(event.key)