My app has only one frame, so for me it's not an issue.

With the code I showed, the app quits if I press cmd-Q, select Quit from
the app menu, *or* close the only window.  That's fine—though I wouldn't
mind if (like most Mac apps) if closing the only window did *not* quit the
app.  What I don't want is for cmd-Q or Quit from the app menu to do
nothing—which is what was happening before.

Maybe there's something better to call, in my OnClose(), than
wx.GetApp().ExitMainLoop(), but I haven't yet found anything that makes the
Quit happen.


On Tue, May 28, 2013 at 4:00 PM, Chris Barker - NOAA Federal <
chris.bar...@noaa.gov> wrote:

> On Tue, May 28, 2013 at 9:50 AM, Charles Hartman <co...@conncoll.edu>
> wrote:
> \
> > I included these lines in the __init__ for my app's Frame (or rather, in
> a
> > long SetupGUI method that is called by __init__):
> >
> >         item = self.fileMenu.Append(wx.ID_EXIT,'E&xit','Terminate the
> > program')
> >         self.Bind(wx.EVT_MENU, self.OnClose, item)
> >
> > Then farther down in the Frame code I have this method:
> >
> >     def OnClose(self, item):
> >         wx.GetApp().ExitMainLoop()
> >
> > That gets exactly the behavior Mac users are used to.
>
> I'm still confused as to why you need that call to ExitMainLoop....
>
> And why this gets you Mac behavior -- the usual Mac behavior is for
> the App NOT to exit when all its Frames are closed.
>
> > for it (until I can test on a Windows machine) that it will also work
> > cross-platform.
>
> note that on any platform, I think this will cause the closing of the
> Frame to kill the App, whether or not there are other frames open --
> if you app supports having more than one frame open at a time, you
> probably don't want that.
>
>
> > Should this be posted somewhere where newbies (like me again) who are
> trying
> > to combine Mac, Python, and wxPython can find it? It is certainly not
> > obvious.
>
> This Wiki Page:
>
> http://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X
>
> Perhaps the term "Optimizing" is a mistake in that title -- these
> aren't really optimizations...
>
> (note the the ID_EXIT is there already, but not the call to MainLoop
> (which I still don't quite get the need for..)
>
> -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
>



-- 

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