import threading,datetime
from tkinter import messagebox
import tkinter
def warning():
root=tkinter.Tk()
msg="现在时间是:"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+",起来喝杯水"
result=messagebox.showwarning(title='warning',message=msg)
root.mainloop()
def func():
global timer
warning()
timer=threading.Timer(5,func)
timer.start()
timer=threading.Timer(5,func)
timer.start()