01 logo

Best way to create Dictionary Application using Python

by The Codezine about a year ago in how to

Python3 Tutorial: How to create a desktop dictionary application.

Hi, Developers! Today, I will be talking about How to Build a Simple Dictionary Application using Python. Also, I assure you guys that it will be really helpful for beginners. Also, after going through this tutorial you will be able to build any kind of Dictionary Application. [For example Spanish, Latin, Hindi, etc.]. Hope you are excited. So let us move on directly to our tutorial "How to build Dictionary Application using python"

## Languages Used in Project:

1. Python 3+ [Tkinter] --->Tkinter is the standard GUI library for Python. Python when joined with Tkinter gives a quick and simple approach to make GUI applications. Tkinter gives an incredible item arranged interface to the Tk GUI toolbox.

Making a GUI application utilizing Tkinter is a simple assignment. You should simply play out the accompanying advances −

  1. Import the Tkinter module.
  2. Make the GUI application primary window.
  3. Include at least one of the previously mentioned gadgets to the GUI application.
  4. Enter the headliner circle to make a move against every occasion set off by the client.

2. JSON --> JSON is a lightweight information trade position. It is simple for people to peruse and compose. It is simple for machines to parse and create. It depends on a subset of the JavaScript Programming Language Standard ECMA-262 third Release - December 1999. JSON is a book group that is totally language autonomous yet utilizes shows that are natural to software engineers of the C-group of dialects, including C, C++, C#, Java, JavaScript, Perl, Python, and numerous others. These properties make JSON a perfect information exchange language.

JSON is based on two structures:

  • An assortment of name/esteem sets. In different dialects, this is acknowledged as an article, record, struct, word reference, hash table, keyed rundown, or cooperative exhibit.
  • An arranged rundown of qualities. In many dialects, this is acknowledged as an exhibit, vector, rundown, or grouping.

 ## Some Features of the codes:

 1. Simple lines of Codes that is easy to understand for beginners

2. Can be modified to a different language dictionary.

3. Errors Free & Bugs Free Codes.

5. Simple JSON data structure.



## Requirements for the Tutorials

1. Basic concepts of python programming.

2. A Pc with the latest version of python 3 installed.

4. A good code ide such as Vs code, Atom, Sublime, etc

4. Your attention & focus on this tutorial.

## CODE

  • import json
  • from difflib import get_close_matches as g
  • data=json.load(open("dictionary.json"))
  • keys = data.keys()
  • def meaning():
  • w = e1_value.get()
  • if w in data:
  • for i, j in enumerate(data[w]):
  • t1.insert(END,str(i)+' '+j+'\n')
  • elif w.upper() in data:
  • for i, j in enumerate(data[w.upper()]):
  • t1.insert(END,str(i)+' '+j+'\n')
  • elif w.title() in data:
  • for i, j in enumerate(data[w.title()]):
  • t1.insert(END,str(i)+' '+j+'\n')
  • else:
  • list=g(w,keys,n=1,cutoff=0.8)
  • if len(list) == 0:
  • t1.insert(END,"Sorry, no word found!")
  • else:
  • real=list[0]
  • answer=tkinter.messagebox.askquestion("Word Suggestion", "Is your word "+real+"?")
  • if answer == "yes":
  • for i, j in enumerate(data[real]):
  • t1.insert(END,str(i)+' '+j+'\n')
  • #elif x == "yes":
  • #for i, j in enumerate(data[real]):
  • #t1.insert(END,str(i)+' '+j+'\n')
  • else:
  • t1.insert(END,"Iss!, no word found. Please check your input word again.")
  • def meaning2():
  • t1.delete(1.0,END)
  • e1.delete(0,END)
  • meaning
  • # Gui Part Starts
  • from tkinter import *
  • import tkinter.messagebox
  • root=Tk()
  • root.title("Dictionary")
  • header=Label(root, text="Python English Dictionary Software", bg="tomato", fg="white")
  • header.pack(fill=X)
  • label1=Label(root, text="Enter your word:")
  • label1.pack()
  • e1_value=StringVar()
  • e1=Entry(root, textvariable=e1_value)
  • e1.pack()
  • button=Button(root, text="Meaning!", command=meaning, bg="dark orchid")
  • button.pack()
  • t1=Text(root)
  • t1.pack(fill=X)
  • label2=Label(root, text="Press it for clearing screen")
  • label2.pack()
  • button2=Button(root,text="Clear Screen!", command=meaning2, bg="dark orchid")
  • button2.pack()
  • root.mainloop()
  •  ## Tutorial:

    1. Build a file called main.py[Python File] & dictionary.json[JSON File] in your ide or in your desktop after making a folder with any name.

    2. Copy the files into your code ide or editor.

    3. Move the codes given in the link below to the appropriate section & save it.

    4. Finally, Run the python by typing python main.py which will help you to execute the py file.

    [## dictionary.json ]

     The dictionary Json File contains all the words & word meanings stored in a structured matter which you can change with your own dialect.

    Source Codes: Python Dictionary Application

     ## Final Word

    I hope the code notations will be easy for any beginners to understand. Lastly, Don’t forget to comment share this blog if you find it useful. Thank you!

    

    how to

    The Codezine

    Blogger & Coder at The Codezine

    Receive stories by The Codezine in your feed
    The Codezine
    Read next: African Engineer Invents 'Talking' Gloves for the Deaf

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2021 Creatd, Inc. All Rights Reserved.