卧槽!Python竟然能做这样的进度条。。。。。
AI算法与图像处理
共 2764字,需浏览 6分钟
·
2021-01-17 07:56
点击上方“AI算法与图像处理”,选择加"星标"或“置顶”
重磅干货,第一时间送达
机器之心编译
选自towardsdatascience 作者:Costas Andreou
import timefrom progress.bar
import IncrementalBarmylist = [1,2,3,4,5,6,7,8]
bar = IncrementalBar( Countdown , max = len(mylist))
for item in mylist:
bar.next()
time.sleep(1)
bar.finish()
Progressbar 的增量进度条
ProgressBar 支持的进度条类型。
import timefrom tqdm
import tqdmmylist = [1,2,3,4,5,6,7,8]
for i in tqdm(mylist):
time.sleep(1)
from alive_progress import alive_barimport
timemylist = [1,2,3,4,5,6,7,8]
with alive_bar(len(mylist)) as bar:
for i in mylist:
bar()
time.sleep(1)
import PySimpleGUI as sgimport
timemylist = [1,2,3,4,5,6,7,8]
for i, item in enumerate(mylist):
sg.one_line_progress_meter( This is my progress meter! , i+1, len(mylist), -key- )
time.sleep(1)
import PySimpleGUI as sgimport
timemylist = [1,2,3,4,5,6,7,8]
progressbar = [ [sg.ProgressBar(len(mylist), orientation= h , size=(51, 10), key= progressbar )]]
outputwin = [ [sg.Output(size=(78,20))]]
layout = [ [sg.Frame( Progress ,layout= progressbar)], [sg.Frame( Output , layout = outputwin)], [sg.Submit( Start ),sg.Cancel()]]
window = sg.Window( Custom Progress Meter , layout)
progress_bar = window[ progressbar ] while True:
event, values = window.read(timeout=10)
if event == Cancel or event is None:
break
elif event == Start :
for i,item in enumerate(mylist):
print(item)
time.sleep(1)
progress_bar.UpdateBar(i + 1)window.close()
参考链接: https://towardsdatascience.com/learning-to-use-progress-bars-in-python-2dc436de81e5 免责声明:本文内容来源于网络,文章版权归原作者所有,意在传播相关技术知识&行业趋势,供大家学习交流,若涉及作品版权问题,请联系删除或授权事宜。
下载1:何恺明顶会分享
在「AI算法与图像处理」公众号后台回复:何恺明,即可下载。总共有6份PDF,涉及 ResNet、Mask RCNN等经典工作的总结分析
下载2:终身受益的编程指南:Google编程风格指南
在「AI算法与图像处理」公众号后台回复:c++,即可下载。历经十年考验,最权威的编程规范!
下载3 CVPR2020 在「AI算法与图像处理」公众号后台回复:CVPR2020,即可下载1467篇CVPR 2020论文 个人微信(如果没有备注不拉群!) 请注明:地区+学校/企业+研究方向+昵称
觉得不错就点亮在看吧
评论