Re: [pygtk] - Callback problem]
Hi Brice, On Thu, 11 Oct 2001 21:57:21 +0200 Brice VISSIERE <[EMAIL PROTECTED]> wrote: > def my_nice_and_very_useful_callback(): > ... return TRUE This should help. Greetings Jürgen -- [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] mainloop vs mainiterator
On Fri, 12 Oct 2001, James Henstridge wrote: > > sp.bar_update("carico", 0.9) > > time.sleep(0.1) > > gtk.mainloop() Heh. Funny that I should be trying a similar thing. My situation is a bit different: I've got the mainloop running already, and in a loop of functions I need to update the display and then sleep. I do this by using James' suggestion of mainiteration and it worked for me. _However_, doing the _final_ update of the statusbar (where I set the value to 1 and changed the label to say finished, it didn't. The statusbar was never drawn in it's full and the label wasn't updated. To get this to work, I did the UI updates and then did gtk.idle_add() of a function that performed the rest of the task. This worked, but using events_pending()/mainiteration() simply hung on me. Isn't that odd? [ gtk.idle_add() is probably the most important function to look at then "things seem darned unreasonable". It will let you work around a lot of problems with the mainloop paradigm. ] Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] mainloop vs mainiterator
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
Re: [pygtk] mainloop vs mainiteration
I'm sorry, I've mispelled: the method is not mainiterator but mainiteration; the question is the same: mainiteration vs mainloop On 12 Oct 2001 10:36:19 +0200, 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 ? > > Best Regards > > Pier Carteri > > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] mainloop vs mainiterator
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 ? Best Regards Pier Carteri ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk