MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / on_search

Function on_search

Dictionary/dictionary.py:43–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 return "The word does not exist. Please double-check it.", None
42
43def on_search():
44 word = entry.get().strip()
45 if word:
46 output, suggestion = translate(word, file)
47 if isinstance(output, list):
48 result_text = ' \n'.join(output)
49 else:
50 result_text = output
51 result_label.config(text=result_text)
52
53 if suggestion:
54 def suggest():
55 suggested_output = translate(suggestion, file)[0]
56 result_label.config(text=suggested_output)
57 suggest_button.pack_forget()
58
59 suggest_button.config(command=suggest, text=f"Search for '{suggestion}'")
60 suggest_button.pack()
61 else:
62 suggest_button.pack_forget()
63 else:
64 messagebox.showwarning("Input Error", "Please enter a word to search.")
65
66#for data access
67file = access_data(file_path)

Callers

nothing calls this directly

Calls 2

translateFunction · 0.85
stripMethod · 0.80

Tested by

no test coverage detected