dededdew
This commit is contained in:
30
test.py
30
test.py
@@ -1,9 +1,23 @@
|
||||
from logly import *
|
||||
import time
|
||||
import tkinter as tk
|
||||
from tkinter import messagebox
|
||||
|
||||
logger.add(
|
||||
"logs/app.log",
|
||||
rotation="daily", # 或 "hourly", "10MB"
|
||||
retention=7,
|
||||
async_write=True # 启用异步写入,不阻塞主线程
|
||||
)
|
||||
logger.success("jegferwgrewgerwg")
|
||||
def show_reminder():
|
||||
root = tk.Tk()
|
||||
root.withdraw() # 隐藏主窗口
|
||||
messagebox.showinfo("提醒", "现在是整点或 30 分啦,注意休息!")
|
||||
root.destroy()
|
||||
|
||||
while True:
|
||||
# 获取当前时间
|
||||
current_time = time.localtime()
|
||||
current_minute = current_time.tm_min
|
||||
print(current_minute)
|
||||
|
||||
if current_minute in [6, 30]:
|
||||
show_reminder()
|
||||
# 避免在同一分钟内重复提醒,等待一分钟
|
||||
time.sleep(60)
|
||||
else:
|
||||
# 如果不是 0 分或 30 分,每隔 10 秒检查一次
|
||||
time.sleep(10)
|
||||
Reference in New Issue
Block a user