Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Chris Barker - NOAA Federal
On Tue, May 28, 2013 at 2:04 PM, Charles Hartman  wrote:
> Right you are -- self.Destroy() does the job.


> I did read the other references you gave -- thanks for those.  I think one
> confusion may be that changes (in Python, in wxPython, maybe in OSX?) may
> have changed the ways to handle this, and some of the old approaches linger
> on the web.

Indeed -- if you see something out of data on the Wiki -- please
correct it! That's the nice thing about a Wiki

-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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Charles Hartman
Right you are -- self.Destroy() does the job.

I did read the other references you gave -- thanks for those.  I think one
confusion may be that changes (in Python, in wxPython, maybe in OSX?) may
have changed the ways to handle this, and some of the old approaches linger
on the web.



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

> On Tue, May 28, 2013 at 1:25 PM, Charles Hartman 
> wrote:
> > My app has only one frame, so for me it's not an issue.
>
> fair enough.
>
> > 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.
>
> see the references I gave earlier if you want to bother with that.
>
>  What
> > I don't want is for cmd-Q or Quit from the app menu to do nothing—which
> is
> > what was happening before.
>
> fair enough.. what did you have before? but this should do it:
>
> def OnClose(self,Event):
> self.Destroy()
>
> that will destroy the Frame, which should make wx exit.
>
> If you don't do that, you may need to call
>
> OnClose
> Event.Skip()
>
> to make sure that the Close event keeps going and does its thing. If
> you had a handler for it, and did not either Destroy the frame or
> callSkip(), ,that might explain the behavior you saw.
>
> Anyway, I've never needed to explicitly end the MainLoop.
>
> -CHB
>
>
> -Chris
>
>
>
>
> > 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
> >  wrote:
> >>
> >> On Tue, May 28, 2013 at 9:50 AM, Charles Hartman 
> >> 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
>
>
>
> --
>
> 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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Chris Barker - NOAA Federal
On Tue, May 28, 2013 at 1:25 PM, Charles Hartman  wrote:
> My app has only one frame, so for me it's not an issue.

fair enough.

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

see the references I gave earlier if you want to bother with that.

 What
> I don't want is for cmd-Q or Quit from the app menu to do nothing—which is
> what was happening before.

fair enough.. what did you have before? but this should do it:

def OnClose(self,Event):
self.Destroy()

that will destroy the Frame, which should make wx exit.

If you don't do that, you may need to call

OnClose
Event.Skip()

to make sure that the Close event keeps going and does its thing. If
you had a handler for it, and did not either Destroy the frame or
callSkip(), ,that might explain the behavior you saw.

Anyway, I've never needed to explicitly end the MainLoop.

-CHB


-Chris




> 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
>  wrote:
>>
>> On Tue, May 28, 2013 at 9:50 AM, Charles Hartman 
>> 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



-- 

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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Charles Hartman
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 
> 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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Chris Barker - NOAA Federal
On Tue, May 28, 2013 at 9:50 AM, Charles Hartman  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
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Charles Hartman
Chris, brilliant!  Many thanks!

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'll take your word
for it (until I can test on a Windows machine) that it will also work
cross-platform.

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.



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

> On Tue, May 28, 2013 at 9:11 AM, Charles Hartman 
> 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
>



-- 

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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Werner F. Bruhin

On 28/05/2013 18:11, Charles Hartman 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.)


item = self.fileMenu.Append(-1,'E&xit','Terminate the program')

Shouldn't that be:
item = self.fileMenu.Append(wx.ID_EXIT,'E&xit','Terminate the 
program')


To get correct cross platform behaviour.

http://wxpython.org/Phoenix/docs/html/MenuItem.html?highlight=menu#MenuItem.__init__

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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Chris Barker - NOAA Federal
On Tue, May 28, 2013 at 9:11 AM, Charles Hartman  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


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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Chris Barker - NOAA Federal
Just found this:

http://wiki.wxwidgets.org/WxMac-specific_topics#When_to_close_the_program

maybe it will help.

-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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Charles Hartman
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 
> 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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Chris Barker - NOAA Federal
On Tue, May 28, 2013 at 5:33 AM, Charles Hartman  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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Charles Hartman
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.
 (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.)  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?  Binding to
wx.EVT_CLOSE doesn't seem to do anything.




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

> On Mon, May 27, 2013 at 10:54 AM, Charles Hartman 
> wrote:
> > You have pointed me to something bizarre.  This is on a Mac.  On Mac,
> though
> > quitting the app closes all top-level windows, closing all top-level
> windos
> > doesn't quit the app.
>
> yes, that's the Mac convension, but teh wx cnvension is for an app to
> quit when all the top-level windows are closed. If you actually want
> the "proper" mac behaviour, you need to create a dummy Frame to keep
> the App alive (and give it a menu bar...)
>
> -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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Charles Hartman
Thanks, but no.  My app never touches EV_CLOSE, and it doesn't do threading
at all.


On Tue, May 28, 2013 at 7:34 AM, Paul Wiseman  wrote:

> On 27 May 2013 16:26, Charles Hartman  wrote:
>
>> I'm coming back to all of this after years away, so I'm sure I'm missing
>> something simple.  I've brought an old 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.
>>
>> Thanks for any help.
>>
>>
> In wx the app will close if all top level frames are closed, so if some
> are left open it wont, did you override some close event handlers possibly
> by binding to EVT_CLOSE?
>
> Also the app will stay running as long as any non-daemon threads are
> running- are you using any threading in the app?
>
>
>>
>> --
>>
>> 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
>>
>>
>


-- 

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


Re: [Pythonmac-SIG] app won't quit?

2013-05-28 Thread Paul Wiseman
On 27 May 2013 16:26, Charles Hartman  wrote:

> I'm coming back to all of this after years away, so I'm sure I'm missing
> something simple.  I've brought an old 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.
>
> Thanks for any help.
>
>
In wx the app will close if all top level frames are closed, so if some are
left open it wont, did you override some close event handlers possibly by
binding to EVT_CLOSE?

Also the app will stay running as long as any non-daemon threads are
running- are you using any threading in the app?


>
> --
>
> 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
>
>
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] app won't quit?

2013-05-27 Thread Charles Hartman
You have pointed me to something bizarre.  This is on a Mac.  On Mac,
though quitting the app closes all top-level windows, closing all top-level
windos doesn't quit the app.  So your question looks irrelevant—but it
isn't!  If I close my app's only window, I see that the app has quit!

Have I somehow discovered the secret to making a Mac behave like a Windows
machine?  (Am I happy?)



On Mon, May 27, 2013 at 1:39 PM, Werner F. Bruhin wrote:

> Hi,
>
>
> On 27/05/2013 19:22, Charles Hartman wrote:
>
>> Running it from the command line doesn't change anything; nothing shows
>> up in Terminal except a message saying that PySimpleApp is now deprecated
>> in wxPython.  But when I changed to the standard App instead, nothing
>> changed.  Nothing shows up in Console either.
>>
>> Following Kevin's suggestion, I'm posting the problem on the wxPython
>> list.
>>
> Could it be that you have any top level windows still open, or a timer not
> stopped or a tray icon which is still around?
>
> Werner
>
> __**_
> 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


Re: [Pythonmac-SIG] app won't quit?

2013-05-27 Thread Werner F. Bruhin

Hi,

On 27/05/2013 19:22, Charles Hartman wrote:
Running it from the command line doesn't change anything; nothing 
shows up in Terminal except a message saying that PySimpleApp is now 
deprecated in wxPython.  But when I changed to the standard App 
instead, nothing changed.  Nothing shows up in Console either.


Following Kevin's suggestion, I'm posting the problem on the wxPython 
list.
Could it be that you have any top level windows still open, or a timer 
not stopped or a tray icon which is still around?


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


Re: [Pythonmac-SIG] app won't quit?

2013-05-27 Thread Charles Hartman
Running it from the command line doesn't change anything; nothing shows up
in Terminal except a message saying that PySimpleApp is now deprecated in
wxPython.  But when I changed to the standard App instead, nothing changed.
 Nothing shows up in Console either.

Following Kevin's suggestion, I'm posting the problem on the wxPython list.


On Mon, May 27, 2013 at 12:38 PM, Ronald Oussoren wrote:

>
> On 27 May, 2013, at 17:26, Charles Hartman  wrote:
>
> > I'm coming back to all of this after years away, so I'm sure I'm missing
> something simple.  I've brought an old 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.
>
> This might be caused by an unhandled exception. Have you tried running the
> app from the command-line (yourapp.app/Contents/MacOS/yourapp)?
>
> Ronald
> >
> > Thanks for any help.
> >
> >
> > --
> >
> > 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
>
>


-- 

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


Re: [Pythonmac-SIG] app won't quit?

2013-05-27 Thread Kevin Walzer
Wxpython bug, that is.

Sent from my iPhone

On May 27, 2013, at 11:26 AM, Charles Hartman  wrote:

> I'm coming back to all of this after years away, so I'm sure I'm missing 
> something simple.  I've brought an old 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.
> 
> Thanks for any help.
> 
> 
> -- 
> 
> 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
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] app won't quit?

2013-05-27 Thread Kevin Walzer
I've observed this with the wxPy demo...may be a ex bug.

Sent from my iPhone

On May 27, 2013, at 11:26 AM, Charles Hartman  wrote:

> I'm coming back to all of this after years away, so I'm sure I'm missing 
> something simple.  I've brought an old 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.
> 
> Thanks for any help.
> 
> 
> -- 
> 
> 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
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] app won't quit?

2013-05-27 Thread Ronald Oussoren

On 27 May, 2013, at 17:26, Charles Hartman  wrote:

> I'm coming back to all of this after years away, so I'm sure I'm missing 
> something simple.  I've brought an old 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.

This might be caused by an unhandled exception. Have you tried running the app 
from the command-line (yourapp.app/Contents/MacOS/yourapp)?

Ronald
> 
> Thanks for any help.
> 
> 
> -- 
> 
> 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

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