On Tue, May 28, 2013 at 9:11 AM, Charles Hartman <co...@conncoll.edu> wrote:
> Thanks, Chris.  My app has a wx.Frame (subclassed, of course).  It's there
> that I've tried Binding EVT_CLOSE, but a breakpoint in the method I find is
> never reached at all, including when I use menu or keyboard to Quit.  On way
> I've tried is this snippet I got from wxPyWiki.  (The line that purports to
> add an Exit item to the File menu does not in fact do that.  Mac still keeps
> Quit in the MyApp menu.)

right -- wx tries hard to make you app more Mac-like by moving menu
items around. If a menu item has ID ID_EXIT, it will get moved, maybe
also if it is called "exit" or "quit". But you want that, yes?

>         item = self.fileMenu.Append(-1,'E&xit','Terminate the program')
>         self.Bind(wx.EVT_MENU, self.OnClose, item)
>         if wx.Platform=="__WXMAC__":
>             wx.App.SetMacExitMenuItemId(item.GetId())
>
> This doesn't work either; OnClose() is never reached.

This is odd, but a few pointers. Try:

        item = self.fileMenu.Append(ex.ID_EXIT,'E&xit','Terminate the program')
        self.Bind(wx.EVT_MENU, self.OnClose, item)
## this shouldn't be needed if you use the ID above.
>         if wx.Platform=="__WXMAC__":
>             wx.App.SetMacExitMenuItemId(item.GetId())

I think you're going to need to put together a sample app. The
enclosed works. (I'd like to add the multiple-frame, app stays alive
thing, though...)

Oh, and you may want to try the "Widget Inspection Tool" -- it may
show you something.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov

Attachment: MacApp.py
Description: Binary data

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to