How to close pygtk application after closing last window

Is there a way that gtk can be called automatically gtk.main_quit()when the last open application window is closed / destroyed?

If there is no direct function offering this functionality, I could think of the following: In the method of destroying a window: get a list of open windows in the process if its output is empty. Is there any way to get such a list?

The obvious solution would be to manually keep track of all open windows, but I would like to avoid this if possible.

+5
source share
2 answers

main window kill signal should be connected to gtk main_quit:

window.connect("destroy", gtk.main_quit)
+7

gtk.main_level(), . gtk.main() gtk.main_quit()

+2

All Articles