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.)

        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.


On Tue, May 28, 2013 at 11:54 AM, Chris Barker - NOAA Federal <
chris.bar...@noaa.gov> wrote:

> On Tue, May 28, 2013 at 5:33 AM, Charles Hartman <co...@conncoll.edu>
> wrote:
> > When I updated my app, I switched from the deprecated wx.PySimpleApp,
> which
> > had the right default behavior on Mac, to wx.App, which apparently
> doesn't.
>
> hmm -- I'm pretty sure that PYSipleApp is deprecated because it
> doesn't actually do anything -- though it way chance a default or two.
> One to look at is crating the app:
>
> app = wx.App(True) will create an extra wx.Frame to capture stout.
>
> app = wx.App(False) will not, and will not re-direct stdout.
>
> > (The docs say "You should normally exit the main loop (and the
> application)
> > by deleting the top window."  What's "normal" for a Windows user would
> > baffle my Mac users, and vice versa—but never mind.)
>
> yup -- and wx follows the Windows/GTK conventions here, so you have to
> kludge a bit to get proper Mac behavior
>
>   I see I can call
> > wxGetApp().ExitMainLoop.  But in response to what?  What is the event
> sent
> > by the Mac keyboard or menu Quit command?
>
> I'm still a bit confused -- if you build an app the regular wx way,
> and it works right on Windows and Linux, then you should get an app
> that goes away when you want it to stay alive, not the other way
> around -- so I would expect you to need to figure out how to keep it
> alive. IIUC, the way to do that is to create a dummy wx.Frame -- it
> will keep the app alive, and give you a menu bar. See this SO thread:
>
>
> http://stackoverflow.com/questions/2934435/how-to-change-the-osx-menubar-in-wxpython-without-any-opened-window
>
> >  Binding to wx.EVT_CLOSE doesn't seem to do anything.
>
> where are you binding that? to the Frame? It's usually a wx.frame event.
>
> Take a look at this:
>
> http://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X
>
> Which does not address the question at hand, but may address other
> questions...And if/when  you find a solution it would be great if  you
> would add it to that page!
>
> -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
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
>



-- 

Charles O. Hartman
Poet in Residence
Lucy Marsh Haskell '19 Professor of Literatures in English
oak.conncoll.edu/cohar
_______________________________________________
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