GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Progressbar does not get totally filled

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
sandra_1984
Familiar Face


Joined: 08 May 2008
Posts: 7

PostPosted: Fri Jun 13, 2008 9:37 am    Post subject: Progressbar does not get totally filled Reply with quote

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?
Back to top
kotnik
Familiar Face


Joined: 09 Feb 2008
Posts: 6

PostPosted: Fri Jun 13, 2008 2:00 pm    Post subject: Reply with quote

The fraction should be between 0.0 and 1.0.

Try this:

Code: (Python)
1
2
3
4
5
6
self.x = 0

for i in range(start,end):
  self.processedfiles += 1
 
self.progressbar.set_fraction(self.processedfiles/self.seq )
  while gtk.events_pending(): gtk.main_iteration()
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP