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

Re: [pygame] Problems with getting keyboard input.



John,

Thanks, that's helped. I guess it's a syntactical thing then: what use does 'is' serve? I assumed it was directly equivalent to '==', but it looks like I was wrong. Secondly, why does using 'is' work with K_ESCAPE and K_SPACE but not with K_UP?

It seems a little illogical, unless I'm missing something.

Cheers.

--jon

On Tue, 25 Jun 2002 19:34:18 +0100
"John Popplewell" <john@johnnypops.demon.co.uk> wrote:

> 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
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org