How can I get a Progressbar to "pulse" while another function is run?
+1
A:
Push that another function into a separate thread. As long as your main thread runs any code, GUI is frozen. This is not a problem for short code pieces, but obviously a problem in your case.
Also read what PyGTK FAQ has to say about using threads in PyGTK program.
doublep
2010-05-10 18:49:09
Thanks for the reply!
Samuel Taylor
2010-05-10 19:42:09
A:
If your function runs in many iterations that don't take too long by themselves, then you don't necessarily need to mess around with separate threads. You can also cause the GUI to update itself during your long calculation:
def long_function(some_args):
while task_is_not_finished():
do_some_stuff_that_doesnt_take_too_long()
progress_bar.pulse()
while gtk.events_pending():
gtk.main_iteration()
ptomato
2010-05-11 13:21:27