请大神看一下这个代码到底哪里出错了

#!/usr/bin/python3
import tkinter as tk
from tkinter import messagebox,Label,StringVar
import time
from schedule import repeat, every, run_pending

@repeat(every(10).seconds, sec=3, msg = "起来喝杯咖啡!")
@repeat(every().day.at("8:50"), sec=6,  msg = "今天打卡了吗?")
@repeat(every().day.at("16:50"), sec=6,  msg = "快到下班时间!")
@repeat(every(1).hours, sec=3, msg = "您需要休息了!")
def show_message(sec=3, msg = ""):
    root = tk.Tk()
    root.title("系统提示")
    root.resizable(False,False)
    root.configure(background='lightcyan')
    root.attributes("-topmost",1)
    w, h = 200, 200
    root.geometry( "%dx%d+%d+%d" %(w,h,(root.winfo_screenwidth()-w)/1-80,(root.winfo_screenheight()-h)/1-30) )
    timerStr = StringVar()
    timerStr.set(time.strftime('%H:%M:%S', time.localtime(time.time())))
    Label(root, textvariable=timerStr, bg='darkturquoise', font=('Microsoft YaHei', 20), fg='white')\
        .place(x=0, y=0, width=200, height=30)
    Label(root, text=msg, bg='lightcyan',  font=('OPPOSans R', 16))\
        .place(x=10, y=100, width=200, height=30)
    root.after(1000*sec, root.destroy )
    root.mainloop()

if __name__ == "__main__":
    print("task started !\n")
    while True:
        run_pending()
        time.sleep(1)

报错如下:

---------------------------------------------------------------------------
ScheduleValueError                        Traceback (most recent call last)
Cell In[14], line 10
      4 import time
      5 from schedule import repeat, every, run_pending
      9 @repeat(every(10).seconds, sec=3, msg = "起来喝杯咖啡!")
---> 10 @repeat(every().day.at("8:50"), sec=6,  msg = "今天打卡了吗?")
     11 @repeat(every().day.at("16:50"), sec=6,  msg = "快到下班时间!")
     12 @repeat(every(1).hours, sec=3, msg = "您需要休息了!")
     13 def show_message(sec=3, msg = ""):
     14     root = tk.Tk()
     15     root.title("系统提示")

File /opt/conda/lib/python3.11/site-packages/schedule/__init__.py:516, in Job.at(self, time_str, tz)
    514 if self.unit == "days" or self.start_day:
    515     if not re.match(r"^[0-2]\d:[0-5]\d(:[0-5]\d)?$", time_str):
--> 516         raise ScheduleValueError(
    517             "Invalid time format for a daily job (valid format is HH:MM(:SS)?)"
    518         )
    519 if self.unit == "hours":
    520     if not re.match(r"^([0-5]\d)?:[0-5]\d$", time_str):

ScheduleValueError: Invalid time format for a daily job (valid format is HH:MM(:SS)?)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值