Word Dictionary using Tkinter

991 views
optmiize_your_resume_1
Word Dictionary using Tkinter in Python

In this article,we will learn how to create Word Dictionary using Tkinter in Python.

As we know Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python.

PyDictionary is a dictionary (as in the English language dictionary) module for Python2 and Python3. PyDictionary provides the following services for a word:

  • meanings
  • translations
  • synonym
  • antonym

How we will proceed

  • Import module
  • Create Normal Tkinter window
  • Add Some Button, Labels & Frames

Syntax:

 # Button
 Button(Object Name, text=”Enter Text”,**attr)
 # Label
 Label(Object Name, text=”Enter Text”, command=”Enter Command” , **attr)
 # Frame
 Frame(Object Name, **attr) 
  • Make a function named as dict. This function will give the meaning, synonym & antonym of given word.
  • Execute code

Source Code with comments : Word Dictionary using Tkinter

# Import Required Library from tkinter import * from PyDictionary import PyDictionary # Create Objects dictionary = PyDictionary() root = Tk() root.title("Word Dictionar- Techarge") root.iconbitmap("Dictionary.ico") root.configure(bg="#8DEEEE") # Set geometry root.geometry("400x400") def dict(): meaning.config(text=dictionary.meaning(word.get())['Noun'][0]) synonym.config(text=dictionary.synonym(word.get())) antonym.config(text=dictionary.antonym(word.get())) # Add Labels, Button and Frames Label(root, text="Dictionary", font=( "Helvetica 15 bold"), fg="Black").pack(pady=10) # Frame 1 frame = Frame(root) Label(frame, text="Type Word", font=("Helvetica 15 bold")).pack(side=LEFT) word = Entry(frame, font=("Helvetica 15 bold")) word.pack() frame.pack(pady=10) # Frame 2 frame1 = Frame(root) Label(frame1, text="Meaning:- ", font=("Helvetica 10 bold")).pack(side=LEFT) meaning = Label(frame1, text="", font=("Helvetica 10")) meaning.pack() frame1.pack(pady=10) # Frame 3 frame2 = Frame(root) Label(frame2, text="Synonym:- ", font=("Helvetica 10 bold")).pack(side=LEFT) synonym = Label(frame2, text="", font=("Helvetica 10")) synonym.pack() frame2.pack(pady=10) # Frame 4 frame3 = Frame(root) Label(frame3, text="Antonym:- ", font=("Helvetica 10 bold")).pack(side=LEFT) antonym = Label(frame3, text="", font=("Helvetica 10")) antonym.pack(side=LEFT) frame3.pack(pady=10) Button(root, text="Submit", font=("Helvetica 15 bold"), command=dict).pack() # Execute Tkinter root.mainloop()
Code language: Python (python)

OUTPUT

So, here is our Word  Dictionary using Tkinter in Python. Simple isn’t it?? This is how we have successfully done with the ‘Word  Dictionary using Tkinter’. I hope the ‘Tkinter and PyDictionary library is now more clear to you and don’t forget to try this code once!!

Word Dictionary using Tkinter

You can play around with the library, explore more features and even customize it further.

ThankYou Pythoner’s!!!

Check out more python projects

20%off for Ink 280 281

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More