From 2db6590fbd1058e6cd7db3a0968e48b165e380a6 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 28 Jun 2008 19:13:37 +0000 Subject: [PATCH] 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 --- get_key.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 get_key.py diff --git a/get_key.py b/get_key.py new file mode 100755 index 00000000..268964bb --- /dev/null +++ b/get_key.py @@ -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) +