app won't quit?

Someone on pythonmac suggested that this may be a wx-specific problem.

I’m bringing an ancient app into the current world:

Python 2.7.5

OS 10.8.3

wxPython 2.9.4.0

py2app 0.7.3

and I rebuilt my setup.py to current specifications. The resulting app works fine (though it’s enormous!), but it won’t respond to a Quit command, keyboard or menu. The menu-bar header (with my app’s name) flashes, but nothing else happens. Nothing shows up in Console, nor in Terminal if I run it from the command line.

Did I miss something important in the last five years?

···

Charles O. Hartman

Poet in Residence

Lucy Marsh Haskell '19 Professor of Literatures in English

oak.conncoll.edu/cohar

Hi,

···

On Monday, May 27, 2013 12:20:23 PM UTC-5, Charles Hartman wrote:

Someone on pythonmac suggested that this may be a wx-specific problem.

I’m bringing an ancient app into the current world:

Python 2.7.5

OS 10.8.3

wxPython 2.9.4.0

py2app 0.7.3

and I rebuilt my setup.py to current specifications. The resulting app works fine (though it’s enormous!), but it won’t respond to a Quit command, keyboard or menu. The menu-bar header (with my app’s name) flashes, but nothing else happens. Nothing shows up in Console, nor in Terminal if I run it from the command line.

Did I miss something important in the last five years?

I think the Mac guys will need a small runnable example to test with. At the very least, you should post the code that is called when you press the close button or whatever. Are you binding to EVT_CLOSE too or just closing with a menu/button event?

  • Mike

Code such as this (from example program simple.py) seems to work OK on Mac OS 10.8:

Create the menubar

menuBar = wx.MenuBar()

and a menu

menu = wx.Menu()

add an item to the menu, using \tKeyName automatically

creates an accelerator, the third param is some help text

that will show up in the statusbar

menu.Append(wx.ID_EXIT, “E&xit\tAlt-X”, “Exit this simple sample”)

bind the menu event to an event handler

self.Bind(wx.EVT_MENU, self.OnTimeToClose, id=wx.ID_EXIT)

and put the menu on the menubar

menuBar.Append(menu, “&File”)

self.SetMenuBar(menuBar)

I think the key is to use the standard menu item ID (wx.ID_EXIT) and not some arbitrary one. It is recognised as special, the shortcut is converted to cmd-Q and the menu item is placed in the program’s menu rather than the File menu.

– CMcP

···

On Monday, 27 May 2013 18:20:23 UTC+1, Charles Hartman wrote:

Someone on pythonmac suggested that this may be a wx-specific problem.

I’m bringing an ancient app into the current world:

Python 2.7.5

OS 10.8.3

wxPython 2.9.4.0

py2app 0.7.3

and I rebuilt my setup.py to current specifications. The resulting app works fine (though it’s enormous!), but it won’t respond to a Quit command, keyboard or menu. The menu-bar header (with my app’s name) flashes, but nothing else happens. Nothing shows up in Console, nor in Terminal if I run it from the command line.

Did I miss something important in the last five years?