[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] key objets



Gerrit Holl wrote:

Hmm, I didn't know .unicode but it seems it is only defined if it is a
character: so for arrows, function keys, etc., it seems not to be defined.
IMHO it seems to be defined with value of u'' so things like isalpha() still works

my testing script:

import sys
import pygame
from pygame.locals import *

pygame.init()
screen = pygame.display.set_mode((468, 60))
while 1:
for e in pygame.event.get():
if e.type == KEYDOWN:
print e.unicode, repr(e.unicode), e.unicode.isalpha()
elif e.type == QUIT:
sys.exit()