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

Re: [pygame] Newbie needs help, what's the most efficient (or easiest) way to do this?



Hi,

don't worry for spamming, I guess that most of us are using filters to move pygame mails in a nice pygame folder :) therefore you do not 'pollute' our mails, you are just using the mailing list as it is intended to be used.

I looked at you program and I don't know why I liked it :P
What you are doing in your current code is reacting when the tab key is typed. But from what you are explaining that's not what you want to do. What you really want to do is react when all other keys are typed. And when one is pressed, you check the state of the tab key to verify if it is pressed or not.

Anyway, keep going, it's nice seeing a project advancing.

I'm not sure it's the cleanest way of doing it but here is the modification I made:
****************************
...
def keyin(self, key):
        tab_is_pressed = pygame.key.get_pressed()[K_TAB]
        if key == self.text[self.current_string][self.pos] and not tab_is_pressed:
            self.pos = self.pos + 1
...
****************************

On Mon, 22 Jan 2007 13:49:54 -0500
"Charles Christie" <sonicbhoc@xxxxxxxxx> wrote:

> Sorry for spamming your email inboxes so much guys... I'm bad at this
> whole email list thing... I'm better with forums, because I can edit
> messages I post and stuff. Eh... Sorry.
> 
> Anyway, now I want the Textsprite class to not accept input while the
> K_TAB button is pressed.
> 
> What would I have to code in this situation? I know that the program,
> upon pressing TAB, should not negatively effect score (I've already
> coded that part) but I don't know how to get it to actually stop
> advancing the pointer as long as the TAB button is held down. I think
> its because the advice I got was for an older version of pygame and
> its not working.
>