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

Re: [pygame] Problems with events and keys



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?

On 2/8/07, Charles Christie <sonicbhoc@xxxxxxxxx> wrote:
I'll fix the timer thing after I figure this out:

In my code, it accepts any keystroke. How do I make it so that the textsprite class only accepts letters, numbers and numberpad input? I know there's a way to do that but I forgot how... Does anybody know what python doc that is in?


On 2/7/07, Charles Christie < sonicbhoc@xxxxxxxxx> wrote:
Uh.... Good question. :P Time to go look at the documentation again!
But I'll do that tomorrow, it's getting kinda late.

On 2/7/07, Lenard Lindstrom < len-l@xxxxxxxxx > wrote:
> Charles Christie wrote:
> >
> > The next thing is events. I haven't checked if the program acts
> > properly if the event GAME_OVER_W is sent after you type everything
> > because I never bothered to finish typing my cue - I am too busy now
> > trying to figure out why SUBTRACT_TIMER (which I should probably
> > rename COUNTDOWN later) won't work with the timer I set. I never had
> > luck with global variables before anyway.
> >
>
> Check your assumptions. When does the timer start?
>
> --
> Lenard Lindstrom
> < len-l@xxxxxxxxx>
>
>
>
>
>