Defer the quit until the mainloop is running again.  something like
self.connect('event-after', gtk.main_quit)

Cheers

On Friday 19 September 2008 17:16, Bart Cramer wrote:
> Dear all,
>
> I am a bit stuck in a small project, trying to quit a PyGTK program.
> Here are some relevant snippets:
>
>       def init_gui (self) :
>
>               self.window = gtk.Window (gtk.WINDOW_TOPLEVEL)
>
>               self.window.connect ("delete_event", self.delete_event)
>               self.window.connect ("destroy", self.destroy)
>
>       def delete_event(self, widget, event, data=None) :
>               return False
>
>       def destroy(self, widget, data=None) :
>               gtk.main_quit()
>
> Seems pretty standard so far... Now, I want the following: if a
> certain condition has been met (categories run out...), the program
> should quit, exit status 0.
>
>               if len(categories) == 0 :
>                       gtk.main_quit()
>
> The error message I get is the following:
>
> RuntimeError: called outside of a mainloop
>
> So I suppose that I should send a signal or event to the main loop,
> which will terminate it by some magic on its own. But how do I do
> that?
>
> Thanks in advance for your time!
>
> Bart.
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to