[Pythonmac-SIG] passing along cmd-key presses

Bob Ippolito bob at redivi.com
Fri May 28 11:30:00 EDT 2004


On May 28, 2004, at 7:57 AM, Jack Nutting wrote:

> I'm working on a game using pygame.  Thanks to some sample code from 
> Bob, I've managed to connect a proper .nib file.  However, my code 
> seems to grab all keystrokes, so that for example cmd-Q doesn't quit 
> the application, but gets picked up as a "q" press by my code.  Do I 
> need to somehow check for the status of the cmd keys, so that I can 
> somehow pass along cmd-key presses to the Cocoa event loop?

You need to catch it yourself and handle it.  SDL captures all 
keypresses.  When you do see a cmd-q you can do 
NSApp().terminate_(None) (you need to import that from AppKit), which 
should quit.

-bob




More information about the Pythonmac-SIG mailing list