[visionegg] converting pygame constants to characters

Hello all,

This is more a pygame issue than VisionEgg, but here goes anyway...

As the GUI functions aren't working on OS X, I'm writing my own dialog box input routines.

As such, I'm checking for valid input using the pygame.event.poll() method, and checking against the pygame constants.

Is there a quick-and-dirty way of converting pygame constants to their appropriate character representations?

Otherwise, it's a case of writing a functions such as:

def convertKeypressToChar(keypress):
    pl = pygame.locals
    if keypress == pl.K_0:
        return '0'
    elif keypress == pl.K_1:
        return '1'
    elif keypress == pl.K_2:
        return '2'
    elif keypress == pl.K_3:
        return '3'
    elif keypress == pl.K_4:
        return '4'
    elif keypress == pl.K_5:
        return '5'
(and so forth, for EACH key....)

Any ideas?

-=Gabriel Nevarez
Research Programmer
Psychology Department
Cardiff University
http://www.cf.ac.uk/psych

======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: