|
|
|
@ -65,8 +65,55 @@ def open_new_window1(conn):
|
|
|
|
|
tk.messagebox.showinfo("提示", "没有新单词!")
|
|
|
|
|
|
|
|
|
|
def open_new_window2(conn):
|
|
|
|
|
def check_spelling():
|
|
|
|
|
user_input = entry_spelling.get().strip()
|
|
|
|
|
if user_input.lower() == current_review_word['word']:
|
|
|
|
|
label_spelling.config(bg='green') # 标记为绿色表示正确
|
|
|
|
|
mark_next_review(conn) # 正确后标记下一个复习
|
|
|
|
|
else:
|
|
|
|
|
label_spelling.config(bg='red') # 错误则标记为红色
|
|
|
|
|
messagebox.showerror("错误", "拼写错误,请重试。")
|
|
|
|
|
|
|
|
|
|
def review_previous_word():
|
|
|
|
|
global current_review_word
|
|
|
|
|
# 实现回顾前一个单词的逻辑,这里简化处理,假设我们有一个全局变量或列表来追踪复习单词
|
|
|
|
|
# 实际应用中,可能需要维护复习单词的历史栈
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def mark_next_review(conn):
|
|
|
|
|
# 假设复习完当前单词后自动标记下一个为复习状态,实际逻辑可能更复杂
|
|
|
|
|
global current_review_word
|
|
|
|
|
next_word = get_learned_word(conn)
|
|
|
|
|
if next_word:
|
|
|
|
|
current_review_word = next_word
|
|
|
|
|
label_meaning.config(text=next_word['meaning'])
|
|
|
|
|
entry_spelling.delete(0, tk.END) # 清空输入框
|
|
|
|
|
label_spelling.config(text="", bg='white') # 重置标签颜色和内容
|
|
|
|
|
else:
|
|
|
|
|
messagebox.showinfo("提示", "没有更多复习单词了!")
|
|
|
|
|
|
|
|
|
|
new_window = Toplevel(root)
|
|
|
|
|
new_window.title("复习单词")
|
|
|
|
|
|
|
|
|
|
current_review_word = get_learned_word(conn)
|
|
|
|
|
if current_review_word:
|
|
|
|
|
label_meaning = tk.Label(new_window, text=current_review_word['meaning'], wraplength=200)
|
|
|
|
|
label_meaning.pack(pady=10)
|
|
|
|
|
|
|
|
|
|
label_spelling = tk.Label(new_window, text="", width=20, bg='white')
|
|
|
|
|
label_spelling.pack(pady=5)
|
|
|
|
|
|
|
|
|
|
entry_spelling = Entry(new_window)
|
|
|
|
|
entry_spelling.pack(pady=5)
|
|
|
|
|
|
|
|
|
|
button_check = tk.Button(new_window, text="检查拼写", command=check_spelling)
|
|
|
|
|
button_check.pack(side=tk.LEFT, padx=5)
|
|
|
|
|
|
|
|
|
|
button_prev = tk.Button(new_window, text="回顾前一个", command=review_previous_word)
|
|
|
|
|
button_prev.pack(side=tk.LEFT, padx=5)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
messagebox.showinfo("提示", "没有复习单词!")
|
|
|
|
|
new_window = Toplevel(root)
|
|
|
|
|
new_window.title("复习单词")
|
|
|
|
|
|
|
|
|
|