我前一段时间创建了此时钟代码,但现在显示的日期不正确。它应该显示1915.7,但显示1914.0,我不确定是什么原因造成的
import sys
from tkinter import *
import datetime
import time
def tick():
date_string = datetime.datetime.now()
date = date_string.strftime('%y%W.%w')
time = date_string.strftime('%H:%M:%S')
display = time+'\n'+date
clock.config(text = display)
clock.after(200,tick)
root = Tk()
root.title('Clock')
clock = Label(root, font = ("Lucida Console", 80, ""), bg = "White", fg = "Black")
clock.pack(fill = 'both', expand = 1)
ws = root.winfo_screenwidth() # width of the screen
hs = root.winfo_screenheight() # height of the screen
x = 750
y = 25
position = '500x210+' + str(x) + '-' + str(y)
root.geometry(position)
root.overrideredirect(1)
root.wm_attributes("-topmost", True)
root.wm_attributes("-disabled", True)
root.wm_attributes("-transparentcolor", "white")
tick()
root.mainloop()