Skip to main content

动画加载栏。这个包是一个加载栏,在运行特定功能时出现动画和文本。此栏在功能完成后停止运行。您可以控制形状和等待消息,甚至是动画

项目描述

时间加载

动画加载栏。这个包是一个加载栏,在运行特定功能时出现动画和文本。此栏在功能完成后停止运行。您可以控制形状和等待消息,甚至动画及其颜色。

Python 包

语言:

* 蟒蛇3

支持的发行版:

分配 版本检查 Python 测试版 支持的 地位 一切正常
Ubuntu 20.04.3 3.6、3.7、3.8、3.9 是的 在职的 是的
温德沃斯 11.6.4 3.6、3.7、3.8、3.9 是的 在职的 是的
苹果系统 10.0.20348 3.6、3.7、3.8、3.9 是的 在职的 是的

安装:

pip install timeloading

用法:

from timeloading import *

# Default usage:
exec(timeloading().loading(function))

# In-depth use:
exec(timeloading(animation,time_w).loading(function,args,msg,done))

"""
Help:
# animation : ascii animation text list. ex: ["⢿","⣻","⣽","⣾","⣷","⣯","⣟","⡿"] OR "⢿⣻⣽⣾⣷⣯⣟⡿"
# time_w : Transition time between animations.
# function : The function name must be a string.
# args : Function variables. ex: (var_name,) OR [var_name]
# msg : Waiting message text.
# done : Message after completion.
"""

例子:

from timeloading import *

# func1:
def func1():
    time.sleep(3)

# func2:
def func2(x):
    time.sleep(x)

# example-1:
# Run the wait function "func1" for 3 seconds with default settings.
exec(timeloading().loading(function="func1"))

# example-2:
# Run the wait function "func2" for 5 seconds and change the message settings.
exec(timeloading().loading(function="func2",args=[5],msg="Loading....",done="ok"))

# example-3:
# The same as the previous example, but with a change in the speed and shape of the animation.
exec(timeloading(animation=["[*  ]","[ * ]","[  *]","[ * ]",],time_w=0.1).loading(function="func2",args=[5],msg="Loading....",done="ok"))

# example-4:
# Example with color
from hexor import * # pip install hexor

p2=hexor(True,"hex")
s0=p2.c("*","#ff0000")
s1=p2.c("*","#760e0e")
s2=p2.c("*","#ff7272")

l=[f"[{s0}{s1}{s2}]",f"[{s1}{s2}{s0}]",f"[{s2}{s0}{s1}]"]
exec(timeloading(animation=l,time_w=0.1).loading(function="func2",args=[5],msg="Loading....",done="ok"))

截屏:

变更日志历史:

## 0.0.1 [13-03-2022]
- First public release.

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

timeloading-0.0.1.tar.gz (4.1 kB 查看哈希)

已上传 source