zoukankan      html  css  js  c++  java
  • python基本学习-实现进度条

    #python基本学习-实现FastPower进度条

    #progress bar

    import time
    scale = 50
    print("执行开始".center(scale//2, '-'))
    start = time.perf_counter()
    for i in range(scale + 1):
        ratio = (i / scale)
        fastPower = pow(ratio + (1 - ratio) / 2, 8)
        movedBar = '*' * int(scale * fastPower)
        residualBar = '.' * int(scale * (1 - fastPower))
        percentFastPower = fastPower * 100
        dur = time.perf_counter() - start
        print(" {:^3.0f}%[{}->{}]{:.2f}s".format(percentFastPower, movedBar, residualBar, dur), end = '')
        time.sleep(0.1)
    print(" "+"执行结束".center(scale//2, '-'))

    根据需要选择不同的设计函数,本例选择的函数为FastPower,开始运行慢,后面运行快

    运行结果:

     文本进度条的设计函数如下:

       

  • 相关阅读:
    Web安全
    前端安全之XSS攻击
    SQL盲注
    Vim使用手册
    VC获取cookies的几种方法
    Wireshark基本介绍和学习TCP三次握手
    细说Cookie
    top100tools
    如何更改Jframe里Jpanel的大小
    HTTP&&Fiddler教程
  • 原文地址:https://www.cnblogs.com/yangyi54920/p/11028343.html
Copyright © 2011-2022 走看看