[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 7:27 PM, Fawkes <fawkesgarde@xxxxxxxxx> wrote:
>                    print (event.key == K_F4 and event.mod == KMOD_ALT)

Try:

print (event.key == K_F4 and bool(event.mod & KMOD_ALT))

I'm not 100% sure, but I would bet that the difference between your
machines is that one of them has NUMLOCK turned on. Note that this
example will trigger on ctrl+alt+F4, shift+alt+F4 and others. If you
don't want that, you'll need to mask for specifically the modifier
keys you care about and not the modifiers (like NUMLOCK) that you
don't care about.