带里程碑的Python加载条
我正在尝试制作一个带有可视化的地下控制程序(当然是为了好玩;D)。我知道有很多不同的加载条库,但如果你知道我的意思,我找不到任何有里程碑的东西。我在windows上使用Python3。我将非常感谢您的帮助使用sys可以实现带有里程碑的加载条:带里程碑的Python加载条,python,loading,Python,Loading,我正在尝试制作一个带有可视化的地下控制程序(当然是为了好玩;D)。我知道有很多不同的加载条库,但如果你知道我的意思,我找不到任何有里程碑的东西。我在windows上使用Python3。我将非常感谢您的帮助使用sys可以实现带有里程碑的加载条: def updt(total, progress): barLength, status = 25, "" progress = float(progress) / float(total) if progress >= 1.
def updt(total, progress):
barLength, status = 25, ""
progress = float(progress) / float(total)
if progress >= 1.:
progress, status = 1, "\r\n"
block = int(round(barLength * progress))
text = "\r[{}] {:.0f}% {}".format(
"#" * block + "-" * (barLength - block), round(progress * 100, 0),
status)
sys.stdout.write(text)
sys.stdout.flush()
runs = 250
for run_num in range(runs):
time.sleep(.1)
updt(runs, run_num + 1)
time.sleep(1)
进度条中的“里程碑”是什么意思?根据我的理解,类似这样的东西可能就是你想要的。