代码拉取完成,页面将自动刷新
import lib
import tkinter
from PIL import Image, ImageTk
lib.load_lanuage()
weather=lib.speak_weather()
bilibili=lib.bilibili()
bilibili_see2=lib.bilibili_see()
eve_text=lib.eve()
eve_text=eve_text.split("。")
eve_text=eve_text[0]
lib.load_config()
def about():
root=tkinter.Tk()
root.geometry('300x150')
root.title("关于")
text=tkinter.Label(root,text="Desp-Widgets V2.3",font=("微软雅黑", 15, "bold"))
text.pack()
text=tkinter.Label(root,text="最后更改时间:2024.1.7 20:00",font=("微软雅黑", 15, "bold"))
text.pack()
root.mainloop()
def open_setting():
root=tkinter.Tk()
root.geometry('300x150')
root.title("设置")
text=tkinter.Label(root,text=lib.lan_data[7])
text.pack()
entry = tkinter.Entry(root, width=50, borderwidth=5)
entry.pack()
def get_data():
data=entry.get()
config=open("config.txt","w",encoding="utf-8")
config.write(data)
config.close()
root.destroy()
yes=tkinter.Button(root,text=lib.lan_data[8],command=get_data)
yes.pack()
root.mainloop()
def exit():
window.destroy()
window=tkinter.Tk()
screenWidth = window.winfo_screenwidth()
screenHeight = window.winfo_screenheight()
width = 700
height = 450
left = screenWidth - width
top = screenHeight - height
window.geometry("%dx%d+%d+%d" % (width, height, left, top))
window.overrideredirect(True)
window.attributes("-alpha",0.8)
window.configure(bg='white')
image = Image.open("bilibili.png")
image = image.resize((220,120))
photo = ImageTk.PhotoImage(image)
wendu=tkinter.Label(window,text=weather[0],bg="white",font=("微软雅黑", 50, "bold"))
wendu.place(x=40, y=50)
wea=tkinter.Label(window,text=weather[1],bg="white",font=("微软雅黑", 35, "bold"))
wea.place(x=160, y=68)
eve=tkinter.Label(window,text=eve_text,bg="white",font=("微软雅黑", 30, "bold"))
eve.place(x=45, y=160)
head=tkinter.Label(image=photo)
head.place(x=25, y=250)
upname=tkinter.Label(window,text=lib.lan_data[0]+lib.up_name,bg="white",font=("微软雅黑", 20, "bold"))
upname.place(x=260, y=250)
bilibli_fan=tkinter.Label(window,text=lib.lan_data[1]+str(bilibili['follower'])+lib.lan_data[2],bg="white",font=("微软雅黑", 20, "bold"))
bilibli_fan.place(x=260, y=300)
bilibli_see=tkinter.Label(window,text=lib.lan_data[3]+str(bilibili_see2['view'])+lib.lan_data[4],bg="white",font=("微软雅黑", 20, "bold"))
bilibli_see.place(x=260, y=350)
setting=tkinter.Button(window,text=lib.lan_data[5],command=open_setting,relief="groove",bg="white",font=("微软雅黑", 15, "bold"))
setting.place(x=480,y=80)
e=tkinter.Button(window,text=lib.lan_data[6],command=exit,bg="white",relief="groove",font=("微软雅黑", 15, "bold"))
e.place(x=560,y=80)
aboutb=tkinter.Button(window,text="关于",command=about,bg="white",relief="groove",font=("微软雅黑", 15, "bold"))
aboutb.place(x=400,y=80)
lan=tkinter.Label(window,text=lib.lan_data[9],bg="white",font=("微软雅黑", 12, "bold"))
lan.place(x=230, y=90)
def update():
eve_text=lib.eve()
eve_text=eve_text.split("。")
eve_text=eve_text[0]
weather=lib.speak_weather()
bilibili=lib.bilibili()
bilibili_see2=lib.bilibili_see()
wendu.configure(text=weather[0])
wea.configure(text=weather[1])
bilibli_fan.configure(text="B站粉丝数:"+str(bilibili['follower'])+"人")
bilibli_see.configure(text="总播放量:"+str(bilibili_see2['view'])+"次")
eve.configure(text=eve_text)
window.after(60000,update)
window.after(60000,update)
window.mainloop()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。