fix 多选题统计不正确
This commit is contained in:
@@ -211,7 +211,6 @@ class Page0(tk.Frame):
|
|||||||
self.text2.insert("end", self.row[14])
|
self.text2.insert("end", self.row[14])
|
||||||
self.text2.config(state="disabled")
|
self.text2.config(state="disabled")
|
||||||
|
|
||||||
correct = 0
|
|
||||||
|
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
state = self.correct_answer[i] + 2 * self.my_answer[i] # 0:未选对, 1:漏选, 2:错选, 3:选对
|
state = self.correct_answer[i] + 2 * self.my_answer[i] # 0:未选对, 1:漏选, 2:错选, 3:选对
|
||||||
@@ -221,12 +220,16 @@ class Page0(tk.Frame):
|
|||||||
self.buttons[i].config(text=full_text, style="Miss.TButton")
|
self.buttons[i].config(text=full_text, style="Miss.TButton")
|
||||||
elif state == 2: # 选错 → 红色
|
elif state == 2: # 选错 → 红色
|
||||||
self.buttons[i].config(text=full_text, style="Wrong.TButton")
|
self.buttons[i].config(text=full_text, style="Wrong.TButton")
|
||||||
correct = 1
|
|
||||||
elif state == 3: # 选对 → 淡绿色
|
elif state == 3: # 选对 → 淡绿色
|
||||||
self.buttons[i].config(text=full_text, style="Correct.TButton")
|
self.buttons[i].config(text=full_text, style="Correct.TButton")
|
||||||
else: # 未选且错误 → 不变(保持原始或默认)
|
else: # 未选且错误 → 不变(保持原始或默认)
|
||||||
self.buttons[i].config(text=full_text, style="Default.TButton")
|
self.buttons[i].config(text=full_text, style="Default.TButton")
|
||||||
|
|
||||||
|
if self.my_answer == self.correct_answer:
|
||||||
|
correct = 1 # 或者 True,表示完全正确
|
||||||
|
else:
|
||||||
|
correct = 0 # 表示不完全正确
|
||||||
|
|
||||||
self.c_backend.update(self.row[0], correct)
|
self.c_backend.update(self.row[0], correct)
|
||||||
self.winfo_toplevel().focus_set()
|
self.winfo_toplevel().focus_set()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user