On 12 Oct 2001, Pier Carteri wrote:

>
> Hi to all,
> I've created a small class that show a splash screen with an image and a
> progressbar. At the end of my module I've add some lines for test the
> class:
>
> if __name__=="__main__":
>     sp=Splash_screen("splash_screen.png",1)
>     sp.show()
>     sp.bar_update("carico", 0.1)
>     time.sleep(4)
>     sp.bar_update("carico", 0.4)
>     time.sleep(3)
>     sp.bar_update("carico", 0.9)
>     time.sleep(0.1)
>     gtk.mainloop()
>
> The window is not shown correctly (basically the bar was never updated
> )and I'm quite sure that the problem is the mainloop call. I've noticed
> that the gtk module has also a mainiterator method that probably is what
> I need: can you please tell me what's the difference between mainloop
> and mainiterator ?

gtk.mainloop() runs the main loop (until the gtk.mainquit is called).
gtk.mainiteration() runs a single iteration of the main loop, then
returns.  As drawing is deferred to run during the main loop, if you don't
give time to it, your app won't redraw.

You can tell the main loop to run while there are events pending with the
following call:
  while gtk.events_pending():
    gtk.mainiteration()

Putting calls like that during the loading of your splash screen should
get things to draw.

James.

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to