开发者

How to quit a pygtk application after last window is closed/destroyed

Is there a way I can tell gtk to automatically call gtk.main_quit() when the last open window of the application is closed/destroyed?

If there is no direct feature offering this functionality, I could think of the following: In the window's destroy method: get a list of open windows in the process, if its empty quit. Is there a way to get such a list?

The obvious solution would be to keep manual开发者_如何学Pythonly track of all open windows, but I would want to avoid this if possible.


the destroy signal of the main window must be connected to gtk main_quit :

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


Use the method gtk.main_level() to get the current nesting level of the main loop. The nesting level is increased by calling the gtk.main() function and reduced by calling the gtk.main_quit() function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜