On Sunday 05 October 2003 03:44, Malcolm Tredinnick wrote:
> I think you may be misunderstanding what pulse() does. It only moves the
> progress bar indicator once. During a time-consuming process, you would
> periodically call the pulse() method to force a small change in the
> progress bar and thus it will look like it is moving during the
> operation.
>
> If you are trying to make the progress bar indicator move backwards and
> forwards after you push the button, you will need to call pulse() many
> times -- probably with a small delay in between so that it doesn't move
> ridiculously fast.
>
Thanks a lot Malcolm,
sorry for the delay answering, but I have tried plenty of times...
Finally I could understand how it work.
This is what I did, maybe is not a perfect style but. I hope can be usefull
for someone else.
#!/usr/bin/env python
import gtk
import time
class progress:
a = 0
def assign(self, a):
self.a = 1
def timeout(self, pbar):
if self.a == 1:
self.pbar.pulse()
else:
pass
return gtk.TRUE
def delete_event(self, widget, data=None):
gtk.main_quit()
return gtk.FALSE
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_resizable(gtk.TRUE)
window.connect("destroy", self.delete_event)
window.set_title("ProgressBar")
window.set_border_width(0)
table = gtk.Table(3, 2, gtk.TRUE)
table.show()
window.add(table)
timer = gtk.timeout_add (100, self.timeout, self)
self.pbar = gtk.ProgressBar()
table.attach(self.pbar, 0, 2, 0, 1)
self.pbar.show()
button1 = gtk.Button(stock=gtk.STOCK_EXECUTE)
button1.connect ('clicked', self.assign)
table.attach(button1, 0, 2, 1, 2)
button1.show()
button = gtk.Button(stock=gtk.STOCK_QUIT)
button.connect("clicked", gtk.mainquit)
table.attach(button, 0, 2, 2, 3)
button.show()
window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
progress()
main()
> Cheers,
> Malcolm
Happy week to everybody
Mario aka Liquid
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/