[pygtk] main_quit called from outside a mainloop
Jakub Piotr Cłapa
loc at toya.net.pl
Sun Dec 4 01:52:35 WST 2005
egbert wrote:
> 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()
If it's going to do this before calling the main loop then why not
reverse the condition and don't call the loop altogether?
If it's going to be done in a event handler than it will be inside the
mainloop.
--
Regards,
Jakub Piotr Cłapa
More information about the pygtk
mailing list