Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带里程碑的Python加载条_Python_Loading - Fatal编程技术网

带里程碑的Python加载条

带里程碑的Python加载条,python,loading,Python,Loading,我正在尝试制作一个带有可视化的地下控制程序(当然是为了好玩;D)。我知道有很多不同的加载条库,但如果你知道我的意思,我找不到任何有里程碑的东西。我在windows上使用Python3。我将非常感谢您的帮助使用sys可以实现带有里程碑的加载条: def updt(total, progress): barLength, status = 25, "" progress = float(progress) / float(total) if progress >= 1.

我正在尝试制作一个带有可视化的地下控制程序(当然是为了好玩;D)。我知道有很多不同的加载条库,但如果你知道我的意思,我找不到任何有里程碑的东西。我在windows上使用Python3。我将非常感谢您的帮助

使用sys可以实现带有里程碑的加载条:

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)
进度条中的“里程碑”是什么意思?根据我的理解,类似这样的东西可能就是你想要的。