Re: Getting Progress bar to display



Mathew Yeates wrote:

Hi-

I'm trying to do the following (forgive the Python)

myprogressbar.show()
longfunc()

but the progress bar does not fully get shown until after the longfunc.
So I tried

myprogressbar.show()
while gtk.events_pending() != 0:
       gtk.mainiteration(gtk.TRUE)
longfunc()

but apparently I need to process for events. So I resorted to

myprogressbar.show()
for i in range(10000):
      while gtk.events_pending() != 0:
        gtk.mainiteration(gtk.TRUE)
longfunc()

and this worked.

What is the correct way to do this? (I can't process the gtk signals from
within longfunc)

you can use a seperate thread to update the progressbar or a gtk_timeout
callback.

timout callbacks are very easy to handle, so i would suggest to look at
the gtk tutorial first for that option.

regards ...
clemens




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]