[pygtk] progressbar not progressing

Pascal Duchatelle pduchatelle at yahoo.fr
Wed Aug 15 18:33:39 WST 2007


Le Tue, 14 Aug 2007 00:58:16 -0700,
John Finlay <finlay at moeraki.com> a écrit :

> Check the FAQ:
> 
> http://faq.pygtk.org/index.py?req=show&file=faq23.020.htp   
> <http://faq.pygtk.org/index.py?req=show&file=faq23.020.htp>  

I managed to have it working. but arranged slightly differently than in
the FAQ. Here is how it works for me (as a call_back).

def call_back(self, button, data):
    task = self.my_task(data)
    gobject.idle_add(task.next)
		
	
def my_task(self, data):
    ...some work...
    while heavy_work_needed:
        ...do heavy work here...
        progress_label.set_text(data) # here we update parts of UI
    # there's more work, return True
        yield True
    # no more work, return False
    yield False

hope it helps anybody. Thanx again.
Pascal



More information about the pygtk mailing list