萝卜头IT论坛

搜索
查看: 457|回复: 7
收起左侧

电子班务栏lite版

[复制链接]
发表于 2024-1-4 16:40:16 | 显示全部楼层 |阅读模式
本帖最后由 许书陌不会C 于 2024-3-3 08:48 编辑

基于 @爱电脑的昕宇 的电子班务栏精简
由接近500行精简为不到100行

eg.已征得原作者同意
image.png

这是原程序
image.png
源代码如下

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()[line]
        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()



eboard-lite.zip

2.79 KB, 下载次数: 33

lite1.0

.eboard.zip

574.77 KB, 下载次数: 12

回复

使用道具 举报

 楼主| 发表于 2024-1-4 20:33:10 | 显示全部楼层

记得交版权费啊
回复

使用道具 举报

发表于 2024-1-4 20:34:52 | 显示全部楼层
同一台电脑忘了换号了,沙发是我发的
回复

使用道具 举报

发表于 2024-1-4 21:43:16 | 显示全部楼层
不错,不错,可以做个课程表,设置根据时间高亮提醒。
回复

使用道具 举报

发表于 2024-1-6 16:05:47 | 显示全部楼层
爱电脑的昕宇 发表于 2024-1-4 20:34
同一台电脑忘了换号了,沙发是我发的

额。。。
有点小尴尬
回复

使用道具 举报

发表于 2024-1-20 22:17:41 | 显示全部楼层
爱电脑的昕宇 发表于 2024-1-4 20:34
同一台电脑忘了换号了,沙发是我发的

可以改啊。。。
回复

使用道具 举报

发表于 2024-1-20 22:18:06 | 显示全部楼层
爱电脑的昕宇 发表于 2024-1-4 20:34
同一台电脑忘了换号了,沙发是我发的

并且发出后24小时内可以删除的
回复

使用道具 举报

发表于 2024-1-20 22:21:41 | 显示全部楼层
我看懂了
这个号是你和你同学共用的
回复

使用道具 举报

联系我们(Contact)|手机版|萝卜头IT论坛 ( 苏ICP备15050961号-1 )

GMT+8, 2024-4-29 01:48 , Processed in 0.098644 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表