[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Is there an InputBox function in pygame/python?
One question: what is K_AT? and will K_a and K_z allow the capital letters too?
And I would love to see what you come up with for a field class if you
eventually decide to make one, but please dont feel urged to do it on
my account. I have something that works at the moment and that's good
enough for me at this point :) I really appreciate your willingness to
do it, however! This has been such a helpful list.
Thanks again,
Denise
On 4/27/05, Daniel Dornhardt <frozensound@xxxxxx> wrote:
> I'll not finish my input field class this evening if you don't
> absolutely need it anymore, D. Hartley.
>
> You could make the input box a little bit safer if you change
>
> elif inkey <= 127:
>
> to
>
> <code>
>
> elif (inkey >= K_a and inkey <= K_z) or \
> (inkey >= K_0 and inkey <= K_9) or \
> (inkey == K_AT):
>
> </code>
>
> You'll have to put any additional characters you want to allow into the
> if, eg. put
>
> (inkey == K_PLUS) or \
>
> after (inkey >= K_0 and inkey <= K_9) or \ to allow the user to enter a
> plus ('+').
>
> the K_AT is an example on how to do it. You could just leave it out, but
> don't forget to remove the 'or \ ' from the line before and replace it
> with an ':' .
>
> It's just a safety measure, for i don't know what'll happen with the
> code if maybe 'tab' is pressed or whatever else may happen.
>
> maybe just the Keys and the numbers will be enough to get on with it?
>