loading-bar-wkl 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Loading/LOADING.py +77 -0
- Loading/__init__.py +3 -0
- loading_bar_wkl-0.1.0.dist-info/METADATA +30 -0
- loading_bar_wkl-0.1.0.dist-info/RECORD +7 -0
- loading_bar_wkl-0.1.0.dist-info/WHEEL +5 -0
- loading_bar_wkl-0.1.0.dist-info/licenses/LICENSE.txt +21 -0
- loading_bar_wkl-0.1.0.dist-info/top_level.txt +1 -0
Loading/LOADING.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
class TextStyle:
|
|
5
|
+
# 普通颜色
|
|
6
|
+
BLACK = '\033[30m'
|
|
7
|
+
RED = '\033[31m'
|
|
8
|
+
GREEN = '\033[32m'
|
|
9
|
+
YELLOW = '\033[33m'
|
|
10
|
+
BLUE = '\033[34m'
|
|
11
|
+
MAGENTA = '\033[35m'
|
|
12
|
+
CYAN = '\033[36m'
|
|
13
|
+
WHITE = '\033[37m'
|
|
14
|
+
|
|
15
|
+
# 加粗普通色
|
|
16
|
+
BOLD_BLACK = '\033[1;30m'
|
|
17
|
+
BOLD_RED = '\033[1;31m'
|
|
18
|
+
BOLD_GREEN = '\033[1;32m'
|
|
19
|
+
BOLD_YELLOW = '\033[1;33m'
|
|
20
|
+
BOLD_BLUE = '\033[1;34m'
|
|
21
|
+
BOLD_MAGENTA = '\033[1;35m'
|
|
22
|
+
BOLD_CYAN = '\033[1;36m'
|
|
23
|
+
BOLD_WHITE = '\033[1;37m'
|
|
24
|
+
|
|
25
|
+
# 高亮浅色
|
|
26
|
+
LIGHT_BLACK = '\033[90m'
|
|
27
|
+
LIGHT_RED = '\033[91m'
|
|
28
|
+
LIGHT_GREEN = '\033[92m'
|
|
29
|
+
LIGHT_YELLOW = '\033[93m'
|
|
30
|
+
LIGHT_BLUE = '\033[94m'
|
|
31
|
+
LIGHT_MAGENTA = '\033[95m'
|
|
32
|
+
LIGHT_CYAN = '\033[96m'
|
|
33
|
+
LIGHT_WHITE = '\033[97m'
|
|
34
|
+
|
|
35
|
+
# 加粗高亮
|
|
36
|
+
BOLD_LIGHT_BLACK = '\033[1;90m'
|
|
37
|
+
BOLD_LIGHT_RED = '\033[1;91m'
|
|
38
|
+
BOLD_LIGHT_GREEN = '\033[1;92m'
|
|
39
|
+
BOLD_LIGHT_YELLOW = '\033[1;93m'
|
|
40
|
+
BOLD_LIGHT_BLUE = '\033[1;94m'
|
|
41
|
+
BOLD_LIGHT_MAGENTA = '\033[1;95m'
|
|
42
|
+
BOLD_LIGHT_CYAN = '\033[1;96m'
|
|
43
|
+
BOLD_LIGHT_WHITE = '\033[1;97m'
|
|
44
|
+
|
|
45
|
+
RESET = '\033[0m'
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def main(min_len, max_len, color, bold=None):
|
|
49
|
+
# 如果想要加粗且当前颜色没加粗,就手工补上
|
|
50
|
+
if bold and '1;' not in color:
|
|
51
|
+
color = '\033[1;' + color[2:]
|
|
52
|
+
|
|
53
|
+
for i in range(min_len, max_len + 1):
|
|
54
|
+
bar = '█' * i
|
|
55
|
+
sys.stdout.write(f'\r{color}{bar}{TextStyle.RESET}')
|
|
56
|
+
sys.stdout.flush()
|
|
57
|
+
time.sleep(0.05) # 速度随意调
|
|
58
|
+
|
|
59
|
+
# 到头了,清爽换行
|
|
60
|
+
print()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
print("浅蓝色,不加粗:")
|
|
65
|
+
main(4, 22, TextStyle.LIGHT_CYAN)
|
|
66
|
+
time.sleep(0.5)
|
|
67
|
+
|
|
68
|
+
print("浅青色,加个粗:")
|
|
69
|
+
main(4, 22, TextStyle.LIGHT_CYAN, bold=True)
|
|
70
|
+
time.sleep(0.5)
|
|
71
|
+
|
|
72
|
+
print("直接拿个加粗亮红:")
|
|
73
|
+
main(5, 20, TextStyle.BOLD_LIGHT_RED)
|
|
74
|
+
time.sleep(0.5)
|
|
75
|
+
|
|
76
|
+
print("普普通通的绿色:")
|
|
77
|
+
main(6, 18, TextStyle.GREEN)
|
Loading/__init__.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loading-bar-wkl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 一个单向伸长的彩色终端加载条
|
|
5
|
+
Author: wkl
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.6
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: classifier
|
|
14
|
+
Dynamic: description
|
|
15
|
+
Dynamic: description-content-type
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
Dynamic: summary
|
|
19
|
+
|
|
20
|
+
# loading-bar
|
|
21
|
+
|
|
22
|
+
一个单向伸长的彩色终端加载条,颜色丰富,不循环不回缩。
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
pip install loading-bar-wkl
|
|
26
|
+
|
|
27
|
+
## 使用
|
|
28
|
+
from Loading import TextStyle, main
|
|
29
|
+
|
|
30
|
+
main(4, 22, TextStyle.LIGHT_CYAN, bold=True)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Loading/LOADING.py,sha256=dBt36CKkesumUYyiCz-WvDaBIPRv5sjPX_otcAR4MX0,1926
|
|
2
|
+
Loading/__init__.py,sha256=SNvKjd7RvssRnGP4HOjiDQCZ5EZI27oGw88Kfg4XpkU,69
|
|
3
|
+
loading_bar_wkl-0.1.0.dist-info/licenses/LICENSE.txt,sha256=KRVhqt_9SOUVHFboO6emEcI6Z67ydbw769UqLT-6q2k,1065
|
|
4
|
+
loading_bar_wkl-0.1.0.dist-info/METADATA,sha256=xRG1qB7hJ4c127HgUrihyYSyG4aRALJ-Y3NiBTNPw-Y,743
|
|
5
|
+
loading_bar_wkl-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
loading_bar_wkl-0.1.0.dist-info/top_level.txt,sha256=Cxnn6EXxE_lP4tJJVJV_YWzriXKwRiSNc6bhrN-j7iE,8
|
|
7
|
+
loading_bar_wkl-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 庄后扬
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Loading
|