[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Problems with getting keyboard input.



Hi,

dont use 'is' when you mean '==' :-)

So this :

    # Check for up arrow, exit loop if found.
    elif event.type is KEYDOWN and event.key is K_UP:
        print "got up!"
        Done = 1

could be :

    # Check for up arrow, exit loop if found.
    elif event.type == KEYDOWN and event.key == K_UP:
        print "got up!"
        Done = 1

cheers,
John.


----- Original Message -----
From: "Jonathan Atkinson" <jonathan_atkinson@yahoo.com>
To: <pygame-users@seul.org>
Sent: Tuesday, June 25, 2002 5:50 PM
Subject: [pygame] Problems with getting keyboard input.


> Hi,
>
> I'm having a little trouble getting keyboard input to with with pygame;
maybe I'm missing something clearly wrong, but as far as I can see right
now, this *should* work, but just doesn't.
>
> I've attached the source. Notice that using the escape or space key works
fine, it's just using K_UP, K_DOWN or any of the K_letter keys that doesn't
seem to work.
>
> Any comments or explainations really would be appreciated.
>
> Cheers,
>
> Jon

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org