Re: app won't quit?

Chris Barker - NOAA Federal <[email protected]>
Newsgroups gmane.comp.python.apple
Message-ID <CALGmxE+5sdjHuS91W0Bg=gmfmC_6zma26y67o5Jq3FdQq=55dw@mail.gmail.com>
On Tue, May 28, 2013 at 9:50 AM, Charles Hartman <[email protected]> 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

[email protected]
_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.