更新 随机选人-tk - 作业版-s.py

This commit is contained in:
people 2023-10-30 14:42:36 +08:00
parent 02fb994f87
commit e5da8b389a

View File

@ -999,7 +999,7 @@ def schedule(fr):
on_button_click(a,'') on_button_click(a,'')
lose=[] lose=[]
if fr=='fromclean': if fr=='fromclean':
step_wid = (50 - root.winfo_width()) / speed step_wid = (80 - root.winfo_width()) / speed
step_hei = (500 - root.winfo_height()) / speed step_hei = (500 - root.winfo_height()) / speed
step_x = (root.winfo_x() - (screen_width)) / speed step_x = (root.winfo_x() - (screen_width)) / speed
step_y = ((root.winfo_y() - root.winfo_screenheight() / 2) + 250) / speed step_y = ((root.winfo_y() - root.winfo_screenheight() / 2) + 250) / speed
@ -1012,9 +1012,9 @@ def schedule(fr):
'{}x{}+{}+{}'.format(int(wid), int(hei), int(root.winfo_x() - step_x), int(root.winfo_y() - step_y))) '{}x{}+{}+{}'.format(int(wid), int(hei), int(root.winfo_x() - step_x), int(root.winfo_y() - step_y)))
root.update() root.update()
root.geometry( root.geometry(
'{}x{}+{}+{}'.format(50, 500, screen_width - 50, root.winfo_screenheight() // 2 - 500 // 2)) '{}x{}+{}+{}'.format(80, 500, screen_width - 50, root.winfo_screenheight() // 2 - 500 // 2))
elif fr=='fromchoice': elif fr=='fromchoice':
step_wid = (50 - root.winfo_width()) / speed step_wid = (80 - root.winfo_width()) / speed
step_hei = (500 - root.winfo_height()) / speed step_hei = (500 - root.winfo_height()) / speed
step_x = (root.winfo_x() - (screen_width)) / speed step_x = (root.winfo_x() - (screen_width)) / speed
step_y = ((root.winfo_y() - root.winfo_screenheight() / 2) + 250) / speed step_y = ((root.winfo_y() - root.winfo_screenheight() / 2) + 250) / speed
@ -1027,9 +1027,9 @@ def schedule(fr):
'{}x{}+{}+{}'.format(int(wid), int(hei), int(root.winfo_x() - step_x), int(root.winfo_y() - step_y))) '{}x{}+{}+{}'.format(int(wid), int(hei), int(root.winfo_x() - step_x), int(root.winfo_y() - step_y)))
root.update() root.update()
root.geometry( root.geometry(
'{}x{}+{}+{}'.format(50, 500, screen_width - 50, root.winfo_screenheight() // 2 - 500 // 2)) '{}x{}+{}+{}'.format(80, 500, screen_width - 50, root.winfo_screenheight() // 2 - 500 // 2))
elif fr=='fromhomework': elif fr=='fromhomework':
step_wid = (50 - root.winfo_width()) / speed step_wid = (80 - root.winfo_width()) / speed
step_hei = (500 - root.winfo_height()) / speed step_hei = (500 - root.winfo_height()) / speed
step_x = (root.winfo_x()-(screen_width)) / speed step_x = (root.winfo_x()-(screen_width)) / speed
step_y = ((root.winfo_y() - root.winfo_screenheight() / 2)+250) / speed step_y = ((root.winfo_y() - root.winfo_screenheight() / 2)+250) / speed
@ -1042,7 +1042,7 @@ def schedule(fr):
'{}x{}+{}+{}'.format(int(wid), int(hei), int(root.winfo_x() - step_x), int(root.winfo_y() - step_y))) '{}x{}+{}+{}'.format(int(wid), int(hei), int(root.winfo_x() - step_x), int(root.winfo_y() - step_y)))
root.update() root.update()
root.geometry( root.geometry(
'{}x{}+{}+{}'.format(50, 500, screen_width - 50,root.winfo_screenheight() // 2 - 500 // 2)) '{}x{}+{}+{}'.format(80, 500, screen_width - 50,root.winfo_screenheight() // 2 - 500 // 2))
root.update() root.update()
root.title('课程表') root.title('课程表')
root.resizable(0, 0) root.resizable(0, 0)
@ -1057,35 +1057,16 @@ def schedule(fr):
on_button_click('请确认课程表文件\n存在且格式正确','') on_button_click('请确认课程表文件\n存在且格式正确','')
log('课程表文件不存在','error') log('课程表文件不存在','error')
root.quit() root.quit()
g=0.113
if len(listindes)==9: if len(listindes)==9:
for i in range(1, len(listindes)): for i in range(1, len(listindes)):
if '/' not in listindes[i]: if '/' not in listindes[i]:
zxs = tkinter.Label(text=listindes[i][0], width=15, font=('华文行楷', 40)) zxs = tkinter.Label(text=listindes[i][0], width=15, font=('华文行楷', 40))
else: else:
zxs = tkinter.Label(text=listindes[i], width=15, font=('华文行楷', 20)) zxs = tkinter.Label(text=listindes[i], width=15, font=('华文行楷', 20))
zxs.place(relx=0.5, rely=g, anchor='center') zxs.grid(column=0,row=i)
g = g + 0.113
elif len(listindes)==10:
for i in range(1, len(listindes)):
if '/' not in listindes[i]:
zxs = tkinter.Label(text=listindes[i][0], width=15, font=('华文行楷', 40))
else:
zxs = tkinter.Label(text=listindes[i], width=15, font=('华文行楷', 20))
zxs.place(relx=0.5, rely=g, anchor='center')
g = g + 0.093
else:
for i in range(1, len(listindes)):
if '/' not in listindes[i]:
zxs = tkinter.Label(text=listindes[i][0], width=15, font=('华文行楷', 40))
else:
zxs = tkinter.Label(text=listindes[i], width=15, font=('华文行楷', 20))
zxs.place(relx=0.5, rely=g, anchor='center')
g = g + 0.106
listindes.clear() listindes.clear()
y = tkinter.Button(text=zhou[d.weekday()], width=15, command=lambda :choice('fromschedule')) y = tkinter.Button(text=zhou[d.weekday()], width=15, command=lambda :choice('fromschedule'))
y.place(relx=0.5, rely=1, anchor='s') y.grid(column=0,row=i+1)
global h global h
h = tkinter.Button(text='添加作业', command=lambda: homework()) h = tkinter.Button(text='添加作业', command=lambda: homework())
h.place(relx=0.5, rely=0, anchor='n') h.place(relx=0.5, rely=0, anchor='n')