[pygtk] Waiting for a module
Paul Borghese
pborghese at gmail.com
Mon Nov 6 23:13:20 WST 2006
Hi,
I have a need to stall my program for about 10 seconds before continuing.
One way would be to simply use the time.sleep(10) function. I feel a more
user friendly way would be to display a progress bar that runs for about 10
seconds. I hacked the example found in the pygtk tutorial:
http://www.pygtk.org/pygtk2tutorial/examples/progressbar.py for such a
purpose. So lets say my program looks as follows:
---------------------------------------------------------
import progressbar
.......
{a bunch of commands}
.......
print "Before Progress Bar ..."
progressbar.ProgressBar()
print "After progress Bar ..."
........
{more commands}
.........
-------------------------------------------------------------
The problem is the program continues to execute in parallel to the progress
bar (in other words the message "After progress bar ..." appears while the
progress bar is still running. I would like the message "after progress
bar..." to only appear once the progress bar has been destroyed.
I eventually fixed the problem by connecting to the destroy signal:
prog=3Dprogressbar.ProgressBar()
prog.window.connect("destroy",RunEND)
Thus the function RunEND is executed once the progressbar is destroyed and
the continuation of my program is placed in RunEND.
Is there a more elegant way of accomplishing the same?
Thanks for your help!
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061106/3d0d0034/at=
tachment.htm
More information about the pygtk
mailing list