27 lines
612 B
Python
27 lines
612 B
Python
import time
|
|
from tqdm import tqdm
|
|
from datetime import datetime
|
|
|
|
|
|
# 获取当前时间的分钟数
|
|
def get_current_minute():
|
|
now = datetime.now()
|
|
return now.minute
|
|
|
|
|
|
# 计算进度
|
|
def calculate_progress(minute):
|
|
return minute % 30
|
|
|
|
|
|
# 创建进度条
|
|
with tqdm(total=30, desc="时间进度", unit="分钟") as pbar:
|
|
while True:
|
|
current_minute = get_current_minute()
|
|
progress = calculate_progress(current_minute)
|
|
# 重置进度条并更新到计算出的进度
|
|
pbar.reset()
|
|
pbar.update(progress)
|
|
# 每秒更新一次进度条
|
|
time.sleep(1)
|