I'm trying to figure out how to properly quit my application when the user tells it to. I know that wx apps quit cleanly when the last window is closed (*). But that just reduces the problem to: how do I close all windows?
>>> wx.__version__
'2.8.4.0'
>>> wx.WindowList
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'WindowList'
So either it's new, or I'm not accessing it properly. Is there some other way to iterate over all windows and tell them to close?
Thanks,
- Joe
(*) Of course sooner or later I'll have the inverse question: how do I keep my app from quitting when all windows are closed? On Mac OS X, at least, it's perfectly normal and valid for most apps to keep running without any windows open. How would I do that in a wx app?
I'm trying to figure out how to properly quit my application when the user tells it to.
(*) Of course sooner or later I'll have the inverse question: how do I keep my app from quitting when all windows are closed?
Both of these were recently discussed on this list -- the second one as recently as yesterday (and no, you can't quite do it right, but you can get close)!
-CHB
···
--
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
I'm trying to figure out how to properly quit my application when the user tells it to. I know that wx apps quit cleanly when the last window is closed (*). But that just reduces the problem to: how do I close all windows?
>>> wx.__version__
'2.8.4.0'
>>> wx.WindowList
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'WindowList'
So either it's new, or I'm not accessing it properly.
It's new. It is now the type of object returned by things like window.GetChildren() and wx.GetTopLevelWindows(), previously those functions returned a real Python list that was a copy of the contents of the wx list, instead of being a wrapper around the live wx list.
Is there some other way to iterate over all windows and tell them to close?
You should still be able to use wx.GetTopLevelWindows, just keep in mind that it is a copy of the wx list at the time that you call the function, and will still have (dead) windows in it after you close them all.
Thanks,
- Joe
(*) Of course sooner or later I'll have the inverse question: how do I keep my app from quitting when all windows are closed? On Mac OS X, at least, it's perfectly normal and valid for most apps to keep running without any windows open. How would I do that in a wx app?
We've just been discussing that on the wxPython-mac list.
Rats, and I thought I'd been paying attention! ...but maybe it wasn't on this list, but on the wxpython-mac list, which I didn't even know about until now!
Thanks,
- Joe
···
On Oct 24, 2008, at 5:30 PM, Christopher Barker wrote:
I'm trying to figure out how to properly quit my application when the user tells it to.
(*) Of course sooner or later I'll have the inverse question: how do I keep my app from quitting when all windows are closed?
Both of these were recently discussed on this list -- the second one as recently as yesterday (and no, you can't quite do it right, but you can get close)!
Is there some other way to iterate over all windows and tell them to close?
You should still be able to use wx.GetTopLevelWindows, just keep in mind that it is a copy of the wx list at the time that you call the function, and will still have (dead) windows in it after you close them all.
Thanks, I hadn't found wx.GetTopLevelWindows. It's the sort of thing you might expect to be mentioned or even linked to from the WindowList page, but it's not.
Is there a wiki or PHP-style wx reference anywhere, where users could contribute helpful tips and cross-references themselves?
Is there some other way to iterate over all windows and tell them to close?
You should still be able to use wx.GetTopLevelWindows, just keep in mind that it is a copy of the wx list at the time that you call the function, and will still have (dead) windows in it after you close them all.
Thanks, I hadn't found wx.GetTopLevelWindows. It's the sort of thing you might expect to be mentioned or even linked to from the WindowList page, but it's not.
Is there a wiki or PHP-style wx reference anywhere, where users could contribute helpful tips and cross-references themselves?
We do have a wiki.here: http://wiki.wxpython.org/ If you decide to contribute to it, try to put your page in one of the previously created categories, unless of course, it just doesn't fit anywhere.