dededdew
This commit is contained in:
28
test1.py
28
test1.py
@@ -1,2 +1,26 @@
|
||||
if 0:
|
||||
print(1)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user