GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Dec 18, 2014 2:26 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Progressbar does not get totally filled
PostPosted: Fri Jun 13, 2008 9:37 am 
Offline
Familiar Face

Joined: Thu May 08, 2008 9:50 am
Posts: 8
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?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 13, 2008 2:00 pm 
Offline
Familiar Face

Joined: Sat Feb 09, 2008 1:54 pm
Posts: 6
The fraction should be between 0.0 and 1.0.

Try this:

Code:
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()


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group