RE: Progressbar does not get totally filled



Due to the nature of floating point numbers and depending on the value of self.step, you may have a value just less than 1.0 on one step and a value greater than 1.0 on the next. Try adding:

    if (self.x> 1.0) self.x = 1.0;

snafu

________________________________
Date: Fri, 13 Jun 2008 13:11:05 +0200
From: sandra derbring gmail com
To: gtk-list gnome org
Subject: Progressbar does not get totally filled

I am using a progressbar to show my users how fast the program is working. My code looks like this:





(self.seq is the number the user chooses (how many word should be shown). I set self.x to 0 first time I run it.)





self.step = 1./self.seq





for i in range(start,end):


self.processedfiles += 1


self.x += self.step


self.progressbar.set_fraction(self.x)


while gtk.events_pending(): gtk.main_iteration()





It works as far as the bar gets filled when I run the program, but it
does not fill up the whole bar (maybe half a step away), and I get this
warning:





:GtkWarning: gtk_progress_set_percentage: assertion `percentage>= 0 && percentage <= 1.0' failed


self.progressbar.set_fraction(self.x)








What is wrong? What can I do to get it totally filled?

_________________________________________________________________
Need to know now? Get instant answers with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008


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