Javi Roman Espinar wrote:

Dear all,

I have a problem with the following program. When I push the button
the program shows the dialog window but doesn't show the labels whithin
the dialog. This labels are shown when the sleep(10) function ends.

Why "events_pending" loop doesn't work? What can I do?
Don't sleep :)

When you call sleep(), the whole process sleeps and you starve the event loop. If you want to do something 10 seconds later, set a timeout with gtk.timeout_add() (the timeout is in milliseconds, so you would pass 10000 as the timeout) and return from your handler. Something like this:
def my_handler():
print "Timeout called
return False
...
gtk.timeout_add(10000, my_handler)

Your handler will then be called from the event loop after the timeout. If you return True from your timeout, it will be requeued with the same delay.

James.

--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/



_______________________________________________
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