Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tqdm 进度条完成后无法消除,在jupyter中可以实现 #25

Open
lanourain opened this issue Aug 31, 2024 · 1 comment
Open

Comments

@lanourain
Copy link

代码参考如下,jupyter中进度条完成后可消除,libro中还存在。

from tqdm.notebook import tqdm_notebook
import time

# 创建一个 total 为 100 的进度条,设置 leave=False 确保进度条在完成后自动清除
tqdm = tqdm_notebook(total=100, leave=False)

# 模拟每 0.5 秒增加 10%
for _ in range(10):
    tqdm.update(10)  # 更新进度10%
    time.sleep(0.5)  # 模拟等待时间

# 确保进度条在完成后被清除
tqdm.clear()
tqdm.close()
@lanourain
Copy link
Author

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant