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

Re: [pygame] I have had a bg but...



black wrote:
>     for event in pygame.event.get():
>     *...*        if event.type in (QUIT, KEYDOWN):
>     *...*            sys.exit()
> 
>     when I test what type an event is I got a number such as 12 which
>     stands for QUIT, but what about (QUIT, KEYDOWN) above ? it is a
>     tuple and event.type definitely  could only return integers.

This is a python language feature
"a in b" returns true if the value a is in the tuple b
so your test above "event.type in (QUIT, KEYDOWN)" returns true if the 
event.type (which is an integer) can be found in the tuple (QUIT, 
KEYDOWN) (which is a tuple of integers).

This information should be in the Python tutorial somewhere, but I 
didn't find it.... someone else knows where to find it?

/Fredrik

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