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

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



Hello again,

I tried Brian's method and it still was not exiting.

I added some print statements to see what was inside each event.

            # looks for event type data to select interaction
            for event in pygame.event.get():

                if event.type == KEYDOWN:
                    print event
                    print event.key
                    print event.mod
                    print (event.key == K_F4 and event.mod == KMOD_ALT)

Output of the diagnostic:

(Left Alt)

<Event(2-KeyDown {'scancode': 62, 'key': 285, 'unicode': u'', 'mod': 4352})>
285
4352
False

(Right Alt)

<Event(2-KeyDown {'scancode': 62, 'key': 285, 'unicode': u'', 'mod': 4608})>
285
4608
False

Should it still be reporting false? (FYI, I am using Pygame 1.9.1 and
Python 2.5.4 if that helps any.)

Ian's method seems to work fine however, so I am leaning towards just
implementing that.

Thanks for the help.
-Fawkes