电子班务栏lite版
本帖最后由 许书陌不会C 于 2024-3-3 08:48 编辑基于 @爱电脑的昕宇 的电子班务栏精简
由接近500行精简为不到100行
eg.已征得原作者同意
这是原程序
源代码如下
from tkinter import *
from datetime import *
from threading import *
import time, os, sys, shutil
global day, event, ft, fgg, bgg, fl, tit, disk0, disk1, disk2
with open('res/disk0.txt') as a:
disk0 = a.read()
with open('res/disk1.txt') as a:
disk1 = a.read()
with open('res/disk2.txt') as a:
disk2 = a.read()
with open('res/tit.txt') as a:
tit = a.read()
with open('res/fgg.txt') as a:
fgg = a.read()
with open('res/bgg.txt') as a:
bgg = a.read()
with open('res/ft.txt') as a:
ft = a.read()
with open('res/fl.txt') as a:
fl = int(a.read())
with open('res/djs.txt') as f:
day = (datetime.strptime(f.readlines()[1], '%Y-%m-%d') - datetime.now()).days
with open('res/djs.txt') as f:
event = f.readlines()[0]
def scan():
while True:
l2.config(text=datetime.now().strftime('%H:%M'))
time.sleep(30)
def open_U():
try:
os.startfile(disk0)
except:
try:
os.startfile(disk1)
except:
os.startfile(disk2)
def cls(line, cn):
with open('res/kcb.txt') as f:
c = f.readlines()
l1.config(text='\n' + c)
l4_.config(text=cn)
a = datetime.now().strftime('%a')
win = Tk()
win.overrideredirect(True)
win.config(bg=fgg)
width = win.winfo_screenwidth()
height = win.winfo_height()
win.geometry('%dx%d+%d+%d' % (500, 420, win.winfo_screenwidth() - 520, win.winfo_screenheight() - 480))
win.attributes("-alpha", 0.9)
title = Label(win, text=tit, fg=bgg, bg=fgg, font=(ft, fl, 'bold'))
l1 = Label(win, text='--', bg=bgg, fg=fgg, font=('微软雅黑', 23), wraplength=250)
l1_ = Label(win, text='今日课程', bg=bgg, fg=fgg, font=('隶书', 15))
l2 = Label(win, text='--', bg=bgg, fg=fgg, font=('微软雅黑', 30))
l3 = Label(win, text=str(day + 1) + '天', bg=bgg, fg=fgg, font=('微软雅黑', 40))
l3_ = Label(win, text='距离' + event + '还有', bg=bgg, fg=fgg, font=('隶书', 15))
l4 = Label(win, text=datetime.now().strftime('%m-%d'), bg=bgg, fg=fgg, font=('微软雅黑', 30))
l4_ = Label(win, text='--', bg=bgg, fg=fgg, font=('隶书', 18))
l6 = Button(win, text='打开U盘', bg=fgg, fg=bgg, font=('微软雅黑', 25), command=lambda: open_U())
l7 = Label(win, bg=fgg, fg=bgg, text='Lite 1.0')
if a == 'Mon':
cls(0, '星期一')
if a == 'Tue':
cls(1, '星期二')
if a == 'Wed':
cls(2, '星期三')
if a == 'Thu':
cls(3, '星期四')
if a == 'Fri':
cls(4, '星期五')
if a == 'Sat':
cls(5, '星期六')
if a == 'Sun':
cls(6, '星期日')
title.place(width=500, height=60, x=0, y=10)
l2.place(width=150, height=150, x=20, y=80)
l1_.place(width=150, height=20, x=245, y=100)
l1.place(width=305, height=150, x=175, y=80)
l3.place(width=150, height=150, x=175, y=235)
l3_.place(width=148, height=40, x=175, y=250)
l4.place(width=150, height=150, x=20, y=235)
l4_.place(width=65, height=20, x=65, y=250)
l6.place(width=150, height=150, x=330, y=235)
l7.place(width=100, height=30, x=210, y=390)
c = Thread(target=scan)
c.start()
win.mainloop()
顶{:05:}
记得交版权费啊{:30:} 同一台电脑忘了换号了,沙发是我发的{:26:} 不错,不错,可以做个课程表,设置根据时间高亮提醒。 爱电脑的昕宇 发表于 2024-1-4 20:34
同一台电脑忘了换号了,沙发是我发的
额。。。
有点小尴尬 爱电脑的昕宇 发表于 2024-1-4 20:34
同一台电脑忘了换号了,沙发是我发的
可以改啊。。。 爱电脑的昕宇 发表于 2024-1-4 20:34
同一台电脑忘了换号了,沙发是我发的
并且发出后24小时内可以删除的 我看懂了
这个号是你和你同学共用的
页:
[1]