diff --git a/src/StuScreen.py b/src/StuScreen.py index 1a1b961..e0380aa 100644 --- a/src/StuScreen.py +++ b/src/StuScreen.py @@ -288,82 +288,82 @@ class StuSc: conn.close() def Exam(self, exam_id, begin_time): - def choose(num): + def Ques_ABCD(num): self.que_no = num no = "第" + str(self.que_no) + "题选项" ts["text"] = no if user_answer[num - 1] == 'A': - bta["bg"] = gai - btb["bg"] = yuan - btc["bg"] = yuan - btd["bg"] = yuan + bta["bg"] = mychoicecolor + btb["bg"] = choicecolor + btc["bg"] = choicecolor + btd["bg"] = choicecolor elif user_answer[num - 1] == 'B': - bta["bg"] = yuan - btb["bg"] = gai - btc["bg"] = yuan - btd["bg"] = yuan + bta["bg"] = choicecolor + btb["bg"] = mychoicecolor + btc["bg"] = choicecolor + btd["bg"] = choicecolor elif user_answer[num - 1] == 'C': - bta["bg"] = yuan - btb["bg"] = yuan - btc["bg"] = gai - btd["bg"] = yuan + bta["bg"] = choicecolor + btb["bg"] = choicecolor + btc["bg"] = mychoicecolor + btd["bg"] = choicecolor elif user_answer[num - 1] == 'D': - bta["bg"] = yuan - btb["bg"] = yuan - btc["bg"] = yuan - btd["bg"] = gai + bta["bg"] = choicecolor + btb["bg"] = choicecolor + btc["bg"] = choicecolor + btd["bg"] = mychoicecolor else: - bta["bg"] = yuan - btb["bg"] = yuan - btc["bg"] = yuan - btd["bg"] = yuan + bta["bg"] = choicecolor + btb["bg"] = choicecolor + btc["bg"] = choicecolor + btd["bg"] = choicecolor - def zt(y): + def Choice_change(y): if y == 'A': - bta["bg"] = gai - btb["bg"] = yuan - btc["bg"] = yuan - btd["bg"] = yuan + bta["bg"] = mychoicecolor + btb["bg"] = choicecolor + btc["bg"] = choicecolor + btd["bg"] = choicecolor elif y == 'B': - bta["bg"] = yuan - btb["bg"] = gai - btc["bg"] = yuan - btd["bg"] = yuan + bta["bg"] = choicecolor + btb["bg"] = mychoicecolor + btc["bg"] = choicecolor + btd["bg"] = choicecolor elif y == 'C': - bta["bg"] = yuan - btb["bg"] = yuan - btc["bg"] = gai - btd["bg"] = yuan + bta["bg"] = choicecolor + btb["bg"] = choicecolor + btc["bg"] = mychoicecolor + btd["bg"] = choicecolor else: - bta["bg"] = yuan - btb["bg"] = yuan - btc["bg"] = yuan - btd["bg"] = gai + bta["bg"] = choicecolor + btb["bg"] = choicecolor + btc["bg"] = choicecolor + btd["bg"] = mychoicecolor user_answer[self.que_no - 1] = y if self.que_no == 1: - button1["bg"] = gai + button1["bg"] = mychoicecolor elif self.que_no == 2: - button2["bg"] = gai + button2["bg"] = mychoicecolor elif self.que_no == 3: - button3["bg"] = gai + button3["bg"] = mychoicecolor elif self.que_no == 4: - button4["bg"] = gai + button4["bg"] = mychoicecolor elif self.que_no == 5: - button5["bg"] = gai + button5["bg"] = mychoicecolor elif self.que_no == 6: - button6["bg"] = gai + button6["bg"] = mychoicecolor elif self.que_no == 7: - button7["bg"] = gai + button7["bg"] = mychoicecolor elif self.que_no == 8: - button8["bg"] = gai + button8["bg"] = mychoicecolor elif self.que_no == 9: - button9["bg"] = gai + button9["bg"] = mychoicecolor else: - button10["bg"] = gai + button10["bg"] = mychoicecolor - def tj(): + def Paperover_Confirm(): for op in user_answer: if op == 'E': tkinter.messagebox.showerror(title='警告', message='温馨提示,您还有题未作答!') @@ -494,31 +494,31 @@ class StuSc: main_panedwindow.add(course_list_frame1) # 定义按钮点击前后颜色 - yuan = 'DimGray' - gai = 'DeepSkyBlue' + choicecolor = 'DimGray' + mychoicecolor = 'DeepSkyBlue' self.window1 = Frame(self.root) # 当前所做所做题号,初始化默认为1 - button1 = Button(self.window1, width=5, text="1", command=lambda: choose(1), bg=yuan) + button1 = Button(self.window1, width=5, text="1", command=lambda: Ques_ABCD(1), bg=choicecolor) - button2 = Button(self.window1, width=5, text="2", command=lambda: choose(2), bg=yuan) + button2 = Button(self.window1, width=5, text="2", command=lambda: Ques_ABCD(2), bg=choicecolor) - button3 = Button(self.window1, width=5, text="3", command=lambda: choose(3), bg=yuan) + button3 = Button(self.window1, width=5, text="3", command=lambda: Ques_ABCD(3), bg=choicecolor) - button4 = Button(self.window1, width=5, text="4", command=lambda: choose(4), bg=yuan) + button4 = Button(self.window1, width=5, text="4", command=lambda: Ques_ABCD(4), bg=choicecolor) - button5 = Button(self.window1, width=5, text="5", command=lambda: choose(5), bg=yuan) + button5 = Button(self.window1, width=5, text="5", command=lambda: Ques_ABCD(5), bg=choicecolor) - button6 = Button(self.window1, width=5, text="6", command=lambda: choose(6), bg=yuan) + button6 = Button(self.window1, width=5, text="6", command=lambda: Ques_ABCD(6), bg=choicecolor) - button7 = Button(self.window1, width=5, text="7", command=lambda: choose(7), bg=yuan) + button7 = Button(self.window1, width=5, text="7", command=lambda: Ques_ABCD(7), bg=choicecolor) - button8 = Button(self.window1, width=5, text="8", command=lambda: choose(8), bg=yuan) + button8 = Button(self.window1, width=5, text="8", command=lambda: Ques_ABCD(8), bg=choicecolor) - button9 = Button(self.window1, width=5, text="9", command=lambda: choose(9), bg=yuan) + button9 = Button(self.window1, width=5, text="9", command=lambda: Ques_ABCD(9), bg=choicecolor) - button10 = Button(self.window1, width=5, text="10", command=lambda: choose(10), bg=yuan) + button10 = Button(self.window1, width=5, text="10", command=lambda: Ques_ABCD(10), bg=choicecolor) button1.pack(side=LEFT, padx=10) @@ -540,16 +540,16 @@ class StuSc: button10.pack(side=LEFT, after=button9, padx=10, pady=5) - bta = Button(self.window1, width=5, text="A", command=lambda: zt('A'), bg=yuan) + bta = Button(self.window1, width=5, text="A", command=lambda: Choice_change('A'), bg=choicecolor) - btb = Button(self.window1, width=5, text="B", command=lambda: zt('B'), bg=yuan) + btb = Button(self.window1, width=5, text="B", command=lambda: Choice_change('B'), bg=choicecolor) - btc = Button(self.window1, width=5, text="C", command=lambda: zt('C'), bg=yuan) + btc = Button(self.window1, width=5, text="C", command=lambda: Choice_change('C'), bg=choicecolor) - btd = Button(self.window1, width=5, text="D", command=lambda: zt('D'), bg=yuan) + btd = Button(self.window1, width=5, text="D", command=lambda: Choice_change('D'), bg=choicecolor) t = "第" + str(self.que_no) + "题选项" - ts = Label(self.window1, width=10, text=t, bg=gai) + ts = Label(self.window1, width=10, text=t, bg=mychoicecolor) ts.pack(side=LEFT, padx=10) # bta.pack(side=LEFT, after=ts, padx=10) # btb.pack(side=LEFT, after=bta, padx=10, pady=5) @@ -561,8 +561,8 @@ class StuSc: btc.pack(side=LEFT, after=btb, padx=10, pady=5) btd.pack(side=LEFT, after=btc, padx=10, pady=5) - tj = Button(self.window1, width=8, text="提交试卷", bg="red", command=tj) - tj.pack(side=LEFT, after=btd, padx=10, pady=5) + Paperover_Confirm = Button(self.window1, width=8, text="提交试卷", bg="red", command=Paperover_Confirm) + Paperover_Confirm.pack(side=LEFT, after=btd, padx=10, pady=5) main_panedwindow.add(self.window1) main_panedwindow.pack(fill=BOTH, expand=1) def SendM(self):