इस लेख में, हम PyDictionary और Tkinter Module का उपयोग करके GUI-based dictionary बनाएंगे।
PyDictionary एक Python Module है जो शब्दों के अर्थ, अनुवाद, विलोम और समानार्थी प्राप्त करने में मदद करता है। यह अर्थ प्राप्त करने के लिए WordNet, अनुवाद के लिए Google, और समानार्थी व विलोम के लिए synonym.com का उपयोग करता है। PyDictionary निर्भरता के रूप में BeautifulSoup और Requests module का उपयोग करता है।
एप्लिकेशन बनाने के लिए, हम पहले pip install PyDictionary का उपयोग करके इन modules को अपने environment में install करेंगे।
Install करने के बाद, हम एक tkinter frame और कुछ अन्य elements बनाएंगे।
उदाहरण
# Import Required Libraries
from tkinter import *
from PyDictionary import PyDictionary
# Create instances and objects
dictionary = PyDictionary()
win = Tk()
# Define the size of the window
win.geometry("700x400")
win.title("Python Dictionary")
# Define Helper Function to use other attributes of PyDictionary Class
def dict():
meaning.config(text=dictionary.meaning(word.get())['Noun'][0])
# Define Labels and Buttons
Label(win, text="Dictionary", font=("Times New Roman", 20)).pack(pady=20)
# Frame 1
frame = Frame(win)
Label(frame, text="Type any Word ", font=("Poppins bold", 15)).pack(side=LEFT)
word = Entry(frame, font=("Times New Roman", 15))
word.pack()
frame.pack(pady=10)
# Frame 2
frame1 = Frame(win)
Label(frame1, text="Meaning:", font=("Aerial", 18)).pack(side=LEFT)
meaning = Label(frame1, text="", font=("Poppins", 15), width=30)
meaning.pack()
frame1.pack(pady=10)
Button(win, text="Find", font=("Poppins bold", 15), command=dict).pack()
# Execute Tkinter
win.mainloop()
आउटपुट
उपरोक्त code चलाने से Dictionary Application बनेगा और display होगा। हालांकि, PyDictionary का उपयोग करके, हम अन्य attributes जैसे समानार्थी, विलोम आदि खोजने की सुविधा जोड़ सकते हैं।

अब textbox में "Hello" टाइप करें और "Find" बटन पर क्लिक करें। यह "Hello" का अर्थ dictionary से खींच लेगा।
