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

Re: [pygame] Unprintable characters



well, you could filter by a list of allowed characters - string.printable for instance

so:
str(event.unicode) in string.printable: good

might need to wrap that in a try:except block in case of weird keys though - not sure...

On Sun, Feb 28, 2010 at 4:56 AM, Chris McCormick <chris@xxxxxxxxxxxx> wrote:
Hi,

Now that the key event returns the unicode character pressed, I want to detect
when a user has pressed an unprintable unicode character (e.g. up arrrow key).
Does anyone know the e.key or e.unicode ranges I need to filter on?

Chris.

-------------------
http://mccormick.cx