On Sun, 2003-11-02 at 21:50, Liquid wrote:
[...]
> > Hope this helps a bit. Secret Technique #1 is the solution to so many of
> > these questions. :-)
> 
> It helps a lot not just a bit, the only problem I have to solve noe is how to 
> exit from the loop in the right way, if I place a return at the end of
> 
>                               while gtk.events_pending():
>                                       gtk.mainiteration(gtk.FALSE)
> 
> just one line will be displayed, if I leave the loop open it wont stop so I 
> cannot, for example, call the mainquit().
> I've read the faq but if the solution is there I haven't understood :p

A GTK+-based program like yours could have a flow something like the
following (very high level):

(1) Set up main window. This includes setting up callback functions for
any menu options, the close button(s) on any windows and so forth.
Basically, having a callback for anything the user can click on or
activate with a keypress and expect a response from.

(2) Perform any time-consuming setup stuff using a loop like the above:
in between filling in the text window, periodically call
gtk.mainiteraion() to process events.

(3) Once all this initial stuff is done (which includes including the
output from "./configure ..." in your case), call gtk.mainloop(). This
will continuously loop, waiting for events to happen, which will cause
the appropriate callbacks to be activated.

So you will not typically call mainquit() as part of the your code
above. Rather, it will be called as part of the callback function for
the "close" signal on your main window. Have a look at FAQ 10.6 (and
also 10.13 for even more information for dialog boxes) showing how this
sort of thing is done.

By the way, an alternative to the steps I outlined above is to do step
(2) in the background, so to speak. That is, do it as part of the idle
loop. See FAQ 20.5 for some hints about that (20.5 deals with a splash
screen, but the idea is adaptable to anything involving the idle loop).

Cheers,
Malcolm
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to