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

Re: [pygame] Unprintable characters



Hi,

I guess you could compare to various K_ variables?



On Tue, Mar 2, 2010 at 7:09 AM, Chris McCormick <chris@xxxxxxxxxxxx> wrote:
That won't work because I specifically want to allow people to type in their
own language. I have chosen a font which supports a large number of glyphs from
different languages for that purpose. What I really want is to filter the small
set of control characters (like left-arrow etc.) but I have no idea how to
discover the range of those characters. Suggestions welcome!

Chris.

On Sun, Feb 28, 2010 at 11:41:38AM -0600, RB[0] wrote:
> 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
> >
-------------------
http://mccormick.cx