@@ -1,37 +1,185 @@
|
||||
|
||||
|
||||
# 爆闪进度条
|
||||
|
||||
#### 介绍
|
||||
一个基于Python的会爆闪的进度条
|
||||
一个基于 Python 的创意进度条库,可以实现炫酷的爆闪效果,让命令行进度条更加生动有趣。
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
## 特性
|
||||
|
||||
- **爆闪特效**:进度条在加载过程中会呈现闪烁效果,吸引注意力
|
||||
- **易于使用**:简洁的 API 设计,快速集成到项目中
|
||||
- **高度可定制**:支持自定义颜色、闪烁速度、进度条样式等参数
|
||||
- **跨平台**:支持 Windows、macOS、Linux 等主流操作系统
|
||||
- **纯 Python 实现**:无需额外依赖,安装简单
|
||||
|
||||
#### 安装教程
|
||||
## 安装
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
### 使用 pip 安装(推荐)
|
||||
|
||||
#### 使用说明
|
||||
```bash
|
||||
pip install flashing-progress-bar
|
||||
```
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
### 源码安装
|
||||
|
||||
#### 参与贡献
|
||||
```bash
|
||||
# 克隆仓库
|
||||
git clone https://gitee.com/louxian-yuan/flashing-progress-bar.git
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
# 进入项目目录
|
||||
cd flashing-progress-bar
|
||||
|
||||
# 安装
|
||||
pip install .
|
||||
```
|
||||
|
||||
#### 特技
|
||||
## 快速开始
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
```python
|
||||
from flashing_progress_bar import FlashingProgressBar
|
||||
|
||||
# 基本用法
|
||||
progress = FlashingProgressBar(total=100)
|
||||
for i in range(101):
|
||||
progress.update(i)
|
||||
# 进度条会自动显示闪烁效果
|
||||
```
|
||||
|
||||
```python
|
||||
# 自定义样式
|
||||
from flashing_progress_bar import FlashingProgressBar
|
||||
|
||||
progress = FlashingProgressBar(
|
||||
total=100,
|
||||
desc="下载中",
|
||||
color="cyan",
|
||||
flash_speed=0.1,
|
||||
width=50
|
||||
)
|
||||
|
||||
for i in range(101):
|
||||
progress.update(i)
|
||||
```
|
||||
|
||||
## API 文档
|
||||
|
||||
### FlashingProgressBar
|
||||
|
||||
进度条的主类,用于创建和管理进度条显示。
|
||||
|
||||
**参数说明:**
|
||||
|
||||
- `total` (int):进度条的总任务量,默认为 100
|
||||
- `desc` (str):进度条的描述信息,默认为空
|
||||
- `color` (str):进度条的颜色,支持多种颜色
|
||||
- `flash_speed` (float):闪烁速度,数值越小闪烁越快
|
||||
- `width` (int):进度条的宽度,默认为 50
|
||||
- `fill` (str):进度条的填充字符
|
||||
- `blank` (str):进度条的空白字符
|
||||
|
||||
**主要方法:**
|
||||
|
||||
- `update(n)`:更新进度条到指定进度
|
||||
- `set_description(desc)`:设置进度条描述
|
||||
- `close()`:关闭进度条
|
||||
|
||||
## 高级用法
|
||||
|
||||
### 自定义闪烁效果
|
||||
|
||||
```python
|
||||
from flashing_progress_bar import FlashingProgressBar
|
||||
|
||||
# 自定义闪烁颜色序列
|
||||
progress = FlashingProgressBar(
|
||||
total=100,
|
||||
colors=["#FF0000", "#00FF00", "#0000FF"],
|
||||
flash_mode="rainbow"
|
||||
)
|
||||
```
|
||||
|
||||
### 多任务进度条
|
||||
|
||||
```python
|
||||
from flashing_progress_bar import FlashingProgressBar
|
||||
|
||||
# 同时管理多个进度条
|
||||
tasks = [
|
||||
{"desc": "任务1", "total": 100},
|
||||
{"desc": "任务2", "total": 200},
|
||||
{"desc": "任务3", "total": 150}
|
||||
]
|
||||
|
||||
bars = []
|
||||
for task in tasks:
|
||||
bar = FlashingProgressBar(**task)
|
||||
bars.append(bar)
|
||||
|
||||
# 更新各个进度条
|
||||
for i in range(101):
|
||||
for bar in bars:
|
||||
bar.update(i)
|
||||
```
|
||||
|
||||
## 配置选项
|
||||
|
||||
### 颜色支持
|
||||
|
||||
支持以下颜色:
|
||||
- 英文颜色名:`red`, `green`, `blue`, `yellow`, `cyan`, `magenta` 等
|
||||
- 十六进制颜色:`#FF0000`, `#00FF00` 等
|
||||
- ANSI 颜色代码
|
||||
|
||||
### 环境变量
|
||||
|
||||
| 环境变量 | 说明 | 默认值 |
|
||||
|---------|------|-------|
|
||||
| `FPB_FLASH_ENABLED` | 是否启用闪烁效果 | `True` |
|
||||
| `FPB_DEFAULT_COLOR` | 默认进度条颜色 | `cyan` |
|
||||
| `FPB_DEFAULT_WIDTH` | 默认进度条宽度 | `50` |
|
||||
|
||||
## 常见问题
|
||||
|
||||
**Q: 闪烁效果不工作?**
|
||||
A: 请检查终端是否支持 ANSI 转义序列,Windows 用户可能需要安装 `colorama` 库。
|
||||
|
||||
**Q: 如何禁用闪烁效果?**
|
||||
A: 在创建进度条时设置 `flash_enabled=False` 或使用环境变量禁用。
|
||||
|
||||
**Q: 支持 Jupyter Notebook 吗?**
|
||||
A: 当前版本主要支持命令行环境,Jupyter Notebook 支持将在后续版本中添加。
|
||||
|
||||
## 更新日志
|
||||
|
||||
### v1.0.0 (2024-01-01)
|
||||
- 初始版本发布
|
||||
- 实现基础进度条功能
|
||||
- 添加爆闪特效
|
||||
|
||||
## 贡献指南
|
||||
|
||||
欢迎对本项目进行贡献!请按照以下步骤参与:
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 创建您的特性分支 (`git checkout -b feature/AmazingFeature`)
|
||||
3. 提交您的更改 (`git commit -m 'Add some AmazingFeature'`)
|
||||
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
||||
5. 创建一个 Pull Request
|
||||
|
||||
## 许可证
|
||||
|
||||
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
|
||||
|
||||
## 联系方式
|
||||
|
||||
- 项目地址:https://gitee.com/louxian-yuan/flashing-progress-bar
|
||||
- 作者:louxian-yuan
|
||||
- 问题反馈:https://gitee.com/louxian-yuan/flashing-progress-bar/issues
|
||||
|
||||
## 感谢
|
||||
|
||||
感谢所有为这个项目做出贡献的人!
|
||||
|
||||
---
|
||||
|
||||
如果本项目对您有帮助,请给项目一个 ⭐ Star 支持一下!
|
||||
Reference in New Issue
Block a user