不使用模块,手动打印进度条
def Run():
for i in range(100):
per = (i + 1) * 100 / 100
self.DownLoadImage(self.hero_url[i], self.hero_name[i])
print("\rdownload %s%.f%s" % ('#' * int(per), per, '%'), flush=True, end='')
利用tqdm模块来显示进度条
frpm tqdm import tqdm
def Run():
for i in tqdm(range(100)):
self.DownLoadImage(self.hero_url[i],self.hero_name[i])
print("\n下载完成")
利用progressbar模块实现进度条
from progressbar import progressbar
def Run():
for i in progressbar(range(100)):
b.Download(hero_url[i], "images/head", hero_name[i])
print("下载完成")