gyt200300 6 months ago
parent 13d4b96f2d
commit ae23f47c35

@ -32,4 +32,10 @@ try:
connection.close() connection.close()
except pymysql.MySQLError as e: except pymysql.MySQLError as e:
print(f"连接数据库时发生错误: {e}") print(f"连接数据库时发生错误: {e}")

@ -158,10 +158,9 @@ class Window2(tk.Toplevel):
def check_spelling(self): def check_spelling(self):
user_input = self.entry_var.get().strip().lower() user_input = self.entry_var.get().strip().lower()
if user_input == self.current_word.lower(): if user_input == self.current_word.lower():
self.user_entry.config(fg="green") # 将输入框文字颜色设为绿色
self.result_label.config(text="正确!", fg="green") self.result_label.config(text="正确!", fg="green")
self.next_button.config(state=tk.NORMAL) # 正确后启用按钮 self.next_button.config(state=tk.NORMAL) # 正确后启用按钮
self.entry_var.set("") # 清空输入框
self.result_label.config(text="")
self.word_error_count[self.current_word] = 0 # 重置错误计数 self.word_error_count[self.current_word] = 0 # 重置错误计数
else: else:
self.result_label.config(text=f"错误!", fg="red") self.result_label.config(text=f"错误!", fg="red")

Loading…
Cancel
Save