Robert - thanks for the advice.
I posted through nabble.com and it looks like it stripped out the code as
it was in a <raw> tag.
I don't fully understand how pygame works and I hoped that by setting
os.environ["SDL_VIDEODRIVER"]
= "dummy" I could capture key presses.
Is this the case or is a real display necessary before pygame can capture
key presses.
Code below.
# Import a library of functions called 'pygame'
import os
import sys
import pygame
import time
os.environ["SDL_VIDEODRIVER"] = "dummy" # No Display
pygame.init()
done = False
while done == False:
print "..."
for event in pygame.event.get():
print "There was a pygame event"
if event.type == pygame.QUIT:
done=True
print "I pressed the QUIT KEY"
time.sleep(2)
if event.type == pygame.KEYDOWN:
print "a key has been pressed KEYKEYKEYKEY"
keypressed = pygame.key.name(event.key)
print (keypressed)
time.sleep(2)