keydisplay.py
1 #!/usr/bin/python
2 import pygame
3 from pygame.locals import *
4 pygame.init()
5
6 screen = pygame.display.set_mode((480, 320))
7
8 font = pygame.font.SysFont("monospace", 12)
9
10 while 1:
11 for e in pygame.event.get():
12 if e.type == KEYDOWN:
13 print e
14 screen.fill((0,0,0))
15 screen.blit(font.render(e.unicode, False, (255,255,255)), (0,0))
16
17 pygame.display.flip()