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

Re: [pygame] Why does ALT+F4 not get recognized here?



On Sun, Sep 13, 2009 at 10:34 AM, Fawkes <fawkesgarde@xxxxxxxxx> wrote:
Hello,
Hi,
           for event in pygame.event.get():
               if event.type == QUIT or (event.type == KEYDOWN and
event.key == KMOD_ALT|K_F4):
                   exit()
               # Other event commands follow
Your use of events here is unusual, and I think it doesn't work.  Try:

key = pygame.key.get_pressed()
for event in pygame.event.get():
    if event.type == QUIT or (event.type == KEYDOWN and event.key == K_F4 and (key[K_LALT] or key[K_LALT])):
        exit()
    #other stuff

Ian