【发布时间】:2010-06-09 09:24:22
【问题描述】:
我正在尝试使用进度条来显示脚本的进度。我希望它在执行类中的每个函数后增加进度。我试过的代码如下:
import progressbar
from time import sleep
class hello():
def no(self):
print 'hello!'
def yes(self):
print 'No!!!!!!'
def pro():
bar = progressbar.ProgressBar(widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
for i in Yep():
bar.update(Yep.i())
sleep(0.1)
bar.finish()
if __name__ == "__main__":
Yep = hello()
pro()
有谁知道如何让这个工作。谢谢
【问题讨论】:
标签: python class progress-bar