[pygtk] main_quit called from outside a mainloop

egbert egbert.bouwman at hccnet.nl
Sat Dec 3 23:56:49 WST 2005


This obviously suicidal script falls into a 
'RunTimeError: called from outside of a mainloop'
caused by gtk.main_quit().
Why ?

    #!/usr/bin/env python
    import gtk
    win = gtk.Window(gtk.WINDOW_TOPLEVEL)
    win.show()
    gtk.main_quit()   # called from outside of a mainloop
    gtk.main()

I know, I can make this script run by using
    win.connect("destroy", gtk.main_quit)
in stead of the guilty line, but that doesn't help me, 
because in my real life script I want to do something like this:

    if some_condition:
        gtk.main_quit()
-- 
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
========================================================================


More information about the pygtk mailing list