[pygtk] change progressbar fraction

Arie Timmerman arietimmerman at gmail.com
Sat Jan 14 17:55:28 WST 2006


I'm trying to make a progressbar for downloading a file. The progressbar 
works doesn't work perfect. It only shows when it is ready 
(ProgressBar.get_fraction == 1). How can i change this.

/while 1:
            data = website.read(1024)
            total = total + len(data)
            fractie = round(total/filesize,1)
            print self.progressbar.get_fraction() #this seems to be OK. 
The result: 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.2 0.2 0.2 
and so on.
            self.progressbar.set_fraction(fractie) # this doesn't change 
the progresbar, i don't see it. The 'visual part' doesn't change. The 
get_fraction() does.
            file.write(data)      
            if not data:
                print "file downloaded"
                break//

How can i make a working progressbar?
/


More information about the pygtk mailing list