我日你妈
62
main.py
@ -1,13 +1,15 @@
|
||||
import os
|
||||
import threading
|
||||
from typing import Callable
|
||||
|
||||
from pyglet import media as pyglet_media
|
||||
|
||||
from tkinter import *
|
||||
from tkinter import font, messagebox, ttk
|
||||
# from tkinter import *
|
||||
from tkinter import font, ttk, END
|
||||
import tkinter
|
||||
import tkinter.messagebox
|
||||
|
||||
import random, tkinter, time, xlrd, datetime, logging, hashlib, os, shutil, pyperclip, requests
|
||||
import random, tkinter, time, xlrd, datetime, logging, hashlib, shutil, pyperclip, requests
|
||||
from ttkbootstrap import Style
|
||||
from docx import Document
|
||||
from PIL import Image, ImageTk
|
||||
@ -387,7 +389,7 @@ def check_class():
|
||||
try:
|
||||
excel = xlrd.open_workbook("support/时刻表.xls") # 打开excel文件
|
||||
sheet = excel.sheet_by_index(0) # 获取工作薄
|
||||
rows: list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
rows: g_list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
index = rows.index("时刻表") # 获取age列所在的列数: 1,也可以换成"password"
|
||||
listindes = sheet.col_values(index) # 获取age列的所有内容
|
||||
for x in range(1, len(listindes)):
|
||||
@ -402,7 +404,7 @@ def check_class():
|
||||
if start_time < now_time < end_time:
|
||||
excel = xlrd.open_workbook("support/课程表.xls") # 打开excel文件
|
||||
sheet = excel.sheet_by_index(0) # 获取工作薄
|
||||
rows: list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
rows: g_list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
index = rows.index(
|
||||
zhou[d.weekday()]
|
||||
) # 获取age列所在的列数: 1,也可以换成"password"
|
||||
@ -428,7 +430,7 @@ def rest():
|
||||
try:
|
||||
excel = xlrd.open_workbook("support/时间表.xls") # 打开excel文件
|
||||
sheet = excel.sheet_by_index(0) # 获取工作薄
|
||||
rows: list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
rows: g_list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
index = rows.index("时间表") # 获取age列所在的列数: 1,也可以换成"password"
|
||||
listindes = sheet.col_values(index) # 获取age列的所有内容
|
||||
for x in range(1, len(listindes)):
|
||||
@ -799,7 +801,7 @@ def homework(pas=None, window=None, line=9999):
|
||||
try:
|
||||
excel = xlrd.open_workbook("support/课程表.xls") # 打开excel文件
|
||||
sheet = excel.sheet_by_index(0) # 获取工作薄
|
||||
rows: list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
rows: g_list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
index = rows.index(
|
||||
zhou[d.weekday()]
|
||||
) # 获取age列所在的列数: 1,也可以换成"password"
|
||||
@ -1396,7 +1398,8 @@ def choice(fromwhere):
|
||||
chosed, \
|
||||
shouldnot, \
|
||||
password, \
|
||||
speed
|
||||
speed, \
|
||||
g_list
|
||||
root.wm_attributes("-topmost", 1)
|
||||
top.destroy()
|
||||
for btn in root.place_slaves():
|
||||
@ -1446,8 +1449,7 @@ def choice(fromwhere):
|
||||
root.geometry("{}x{}+{}+{}".format(400, 300, 0, 0))
|
||||
root.update()
|
||||
root.title("随机选人")
|
||||
global list
|
||||
list = []
|
||||
g_list = []
|
||||
status = "开始"
|
||||
back = tkinter.Button(
|
||||
text="返回", command=lambda: schedule("fromchoice"), font=("微软雅黑", 10)
|
||||
@ -1480,8 +1482,8 @@ def choice(fromwhere):
|
||||
with open("support/1.txt", "r") as f:
|
||||
for x in f.readlines():
|
||||
x = x.strip("\n")
|
||||
list.append(x)
|
||||
info = str(len(list))
|
||||
g_list.append(x)
|
||||
info = str(len(g_list))
|
||||
f.close()
|
||||
with open("support/journal.log") as c:
|
||||
jour = []
|
||||
@ -1520,7 +1522,7 @@ def choice(fromwhere):
|
||||
pass
|
||||
if (rest()) or (not rest() and password):
|
||||
log("人名单sha256:" + file_sha256(r"support/1.txt"), "info")
|
||||
log("当前有" + str(len(list)) + "人", "info")
|
||||
log("当前有" + str(len(g_list)) + "人", "info")
|
||||
password = False
|
||||
except Exception as e:
|
||||
on_button_click("没有找到人名单文件或因\n" + str(e), "")
|
||||
@ -1583,18 +1585,18 @@ def choice(fromwhere):
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if int(episode_name) != len(list):
|
||||
if int(episode_name) != len(g_list):
|
||||
on_button_click(
|
||||
"人名单中的人数\n与上次运行时不一致,\n请检查人名单是否被篡改。\n按确定以继续。",
|
||||
"",
|
||||
)
|
||||
for i in set(list):
|
||||
if list.count(i) > 1:
|
||||
for i in set(g_list):
|
||||
if g_list.count(i) > 1:
|
||||
if on_button_click(
|
||||
"在人名单文件中,"
|
||||
+ i
|
||||
+ "出现了"
|
||||
+ str(list.count(i))
|
||||
+ str(g_list.count(i))
|
||||
+ "次,\n请检查人名单是否被篡改。\n重复的元素将会引发程序错误,\n在删除重复的元素之前请勿运行此模块。\n按确定以退出。",
|
||||
"",
|
||||
):
|
||||
@ -1610,7 +1612,7 @@ def choice(fromwhere):
|
||||
pass
|
||||
|
||||
def stop(r):
|
||||
global flag, status, list, info, a, chosed, inf
|
||||
global flag, status, g_list, info, a, chosed, inf
|
||||
flag = True
|
||||
status = "开始"
|
||||
if not rest():
|
||||
@ -1651,7 +1653,7 @@ def choice(fromwhere):
|
||||
start.place(relx=0.5, rely=1, anchor="s")
|
||||
|
||||
def main():
|
||||
global flag, root, list, status, info, a, chosed, inf
|
||||
global flag, root, g_list, status, info, a, chosed, inf
|
||||
try:
|
||||
inf.destroy()
|
||||
except:
|
||||
@ -1660,7 +1662,7 @@ def choice(fromwhere):
|
||||
status = "就你了"
|
||||
start = tkinter.Button(
|
||||
text=status,
|
||||
command=lambda: stop(list[r]),
|
||||
command=lambda: stop(g_list[r]),
|
||||
font=("宋体", 24),
|
||||
width=30,
|
||||
bg="#4472c4",
|
||||
@ -1669,19 +1671,19 @@ def choice(fromwhere):
|
||||
)
|
||||
start.place(relx=0.5, rely=1, anchor="s")
|
||||
while not flag:
|
||||
r = random.randint(0, len(list) - 1)
|
||||
if len(chosed) == len(list) - 5:
|
||||
r = random.randint(0, len(g_list) - 1)
|
||||
if len(chosed) == len(g_list) - 5:
|
||||
chosed.clear()
|
||||
with open("support/record.txt", "a+") as g:
|
||||
g.truncate(0)
|
||||
g.close()
|
||||
log("操作后sha256:" + file_sha256(r"support/record.txt"), "info")
|
||||
if (list[r] not in chosed) and (int(nolis.get()) == 0):
|
||||
if (g_list[r] not in chosed) and (int(nolis.get()) == 0):
|
||||
try:
|
||||
a.destroy()
|
||||
except:
|
||||
pass
|
||||
a = tkinter.Label(text=list[r], width=30, font=("华文行楷", 72))
|
||||
a = tkinter.Label(text=g_list[r], width=30, font=("华文行楷", 72))
|
||||
a.place(relx=0.5, rely=0.4, anchor="center")
|
||||
root.update()
|
||||
time.sleep(0.01)
|
||||
@ -1690,7 +1692,7 @@ def choice(fromwhere):
|
||||
a.destroy()
|
||||
except:
|
||||
pass
|
||||
a = tkinter.Label(text=list[r], width=30, font=("华文行楷", 72))
|
||||
a = tkinter.Label(text=g_list[r], width=30, font=("华文行楷", 72))
|
||||
a.place(relx=0.5, rely=0.4, anchor="center")
|
||||
root.update()
|
||||
time.sleep(0.01)
|
||||
@ -1830,7 +1832,7 @@ def schedule(fr):
|
||||
try:
|
||||
excel = xlrd.open_workbook("support/课程表.xls") # 打开excel文件
|
||||
sheet = excel.sheet_by_index(0) # 获取工作薄
|
||||
rows: list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
rows: g_list = sheet.row_values(0) # 获取第一行的表头内容
|
||||
index = rows.index(
|
||||
zhou[d.weekday()]
|
||||
) # 获取age列所在的列数: 1,也可以换成"password"
|
||||
@ -1903,7 +1905,7 @@ def schedule(fr):
|
||||
top.overrideredirect(True)
|
||||
top.wm_attributes("-topmost", 1)
|
||||
try:
|
||||
if type(check_class()) == tuple:
|
||||
if isinstance(check_class(), tuple):
|
||||
btn = tkinter.Button(
|
||||
top,
|
||||
text=check_class()[0][0] + "→" + check_class()[1][0],
|
||||
@ -1982,16 +1984,16 @@ def count():
|
||||
|
||||
def bsy(fro=None):
|
||||
global top
|
||||
if fro == None:
|
||||
if fro is None:
|
||||
time.sleep(10)
|
||||
while type(check_class()) == tuple:
|
||||
while isinstance(check_class(), tuple):
|
||||
try:
|
||||
btn.config(text=check_class()[0][0] + "→" + check_class()[1][0])
|
||||
time.sleep(check_resttime() + 3)
|
||||
except tkinter.TclError:
|
||||
time.sleep(check_resttime() + 3)
|
||||
else:
|
||||
if type(check_class()) == str:
|
||||
if isinstance(check_class(), str):
|
||||
btn.config(text=check_class())
|
||||
else:
|
||||
btn.config(text="", image=choice_photo)
|
||||
|
BIN
support.zip
3
support/1.txt
Normal file
@ -0,0 +1,3 @@
|
||||
姓名1
|
||||
姓名2
|
||||
姓名3
|
BIN
support/back.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
support/bigback.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
support/check.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
support/choice.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
1
support/config.ini
Normal file
@ -0,0 +1 @@
|
||||
pwd:zjb524780
|
BIN
support/continue.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
support/countdown.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
support/cross.png
Normal file
After Width: | Height: | Size: 882 B |
BIN
support/down.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
support/flag.png
Normal file
After Width: | Height: | Size: 442 KiB |
1
support/info.txt
Normal file
@ -0,0 +1 @@
|
||||
晚自习:18:00
|
0
support/journal.log
Normal file
BIN
support/left_arrow.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
support/line.png
Normal file
After Width: | Height: | Size: 571 B |
BIN
support/loading.gif
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
support/lock.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
support/others.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
support/paus.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
support/pen.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
0
support/record.txt
Normal file
BIN
support/right_arrow.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
support/save_and_continue.png
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
support/settings.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
support/smile.jpg
Normal file
After Width: | Height: | Size: 978 B |
BIN
support/sound.mp3
Normal file
BIN
support/sport.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
support/star.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
support/stop.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
1
support/subjects
Normal file
@ -0,0 +1 @@
|
||||
语文
|
BIN
support/tick.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
support/top.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
support/up.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
support/video.png
Normal file
After Width: | Height: | Size: 746 B |
BIN
support/化学.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
support/历史.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
support/地理.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
support/政治.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
support/数学.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
support/时刻表.xls
Normal file
BIN
support/时间表.xls
Normal file
BIN
support/物理.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
support/生物.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
support/英语.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
support/语文.png
Normal file
After Width: | Height: | Size: 8.5 KiB |