[PyQt] addAction to menubar

Colin McPhail colin.mcphail at talktalk.net
Sun Feb 14 11:36:00 GMT 2010


On 13 Feb 2010, at 23:50, David Arnold wrote:

> Hi,
> 
> I'm trying some of the zetcode tutorials. How come no menu item shows up on my Macbook when I execute the following?
> 

For basic actions like quitting, Mac OS X likes all applications to present a standard user interface.  When your main window has focus click on its program menu (the word Python in bold at the left end of the Mac menu bar): at the bottom of the menu is the entry 'Quit Python' with the shortcut cmd+Q.  This is your 'Exit' menu item! (You can tell it is yours because it should also be showing the exit.png icon you specified.)  Something (I'm not sure if it is Qt or Mac OS X itself) has intercepted your 'Exit' menu item, moved it from the File menu to the program menu and standardised its format.  Because the File menu now has no entries it is not displayed.

If you choose another name for your menu item in the QAction call, say 'Parrot', and change its shortcut from 'Ctrl+Q' (which is reserved for Quit) to 'Ctrl+P', say, then the File menu will appear with the 'Parrot' menu item in it.  The program menu will contain the default 'Quit Python' item.

Regards,
-- CMcP


More information about the PyQt mailing list