Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while work_left:
- ...do something...
- progressbar.set_fraction(...)
- while work_left:
- ...do something...
- progressbar.set_fraction(...)
- while gtk.events_pending():
- gtk.main_iteration()
- def my_task(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
- def on_start_my_task_button_click(data):
- task = my_task(data)
- gobject.idle_add(task.next)
- #Callback function invoked when download/upload has progress
- def progress(download_t, download_d, upload_t, upload_d):
- print 'in fileupload progress'
- mainwin.mainw.prog_bar.set_fraction(upload_d/upload_t)
- #Callback function invoked when download/upload has progress
- def progress(download_t, download_d, upload_t, upload_d):
- print 'in fileupload progress'
- mainwin.mainw.prog_bar.set_fraction(float(upload_d) / upload_t)
Add Comment
Please, Sign In to add comment