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

Re: [pygame] Problems with events and keys



Charles Christie wrote:
Oh wait, what I was thinking for was something completely different. I actually have no clue on how to restrict the textsprite class to only accept letters, numbers and keypad strokes simply and cleanly. I could just go and make a looooooong if/else statement that either has all the keys I want or all the keys I don't want to respond to... either way looks really long and painful >.<

Please let me rephrase my question: Is there a clean way to make my program only accept letters, numbers and number pad input and ignore everything else?


Python strings have several methods for character testing. String methods are documented in the Python Library Reference under Built-in Types/Sequence Types.


--
Lenard Lindstrom
<len-l@xxxxxxxxx>