On Sun, May 29, 2005 at 12:27:11PM -0700, David M. Cook wrote:
> On Sun, May 29, 2005 at 09:11:34PM +0200, Calle Erlandsson wrote:
>
> > But this create a new problem: When I've closed all the windows the app
> > is still running because I haven't run the gtk.main_quit().
> > How do I solve this problem?
>
> The function
>
> gtk.window_list_toplevels()
>
> may be helpful here. Just check after destroying a window for how many are
> left.
Kiwi2 also has a quit_is_last function that may come in handy:
def quit_if_last(*args):
windows = [toplevel
for toplevel in gtk.window_list_toplevels()
if toplevel.get_property('type') == gtk.WINDOW_TOPLEVEL]
if len(windows) == 1:
gtk.main_quit()
The *args is only useful to allow you to use it as a signal handler. I have no
clue why list_toplevels would return windows which did not have the type
WINDOW_TOPLEVEL but..
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3376 0125
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/