Skip to content

Commit 35e7cdb

Browse files
Merge pull request KrishGaur1354#14 from mohitchandak/main
Added Dictionary App
2 parents a20a9c1 + 9c661b5 commit 35e7cdb

File tree

4 files changed

+109
-0
lines changed

4 files changed

+109
-0
lines changed

Dictionary_App/Dictionary.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import json
2+
from difflib import get_close_matches
3+
from tkinter import *
4+
from tkinter import messagebox
5+
import threading
6+
import os.path
7+
import dload
8+
import urllib.request
9+
root = Tk()
10+
root.title("DictionaryApp[BETA]")
11+
root.geometry("700x300")
12+
root.configure(bg="black")
13+
messagebox.showinfo("Hello There!","Welcome to DictionaryApp[BETA]\nPlease click on ConnectToService to get started!")
14+
root.update_idletasks()
15+
global my_input
16+
my_input = Entry(root, width=60, borderwidth=3)
17+
my_input.insert(0, "Please enter a word")
18+
my_input.pack()
19+
root.update_idletasks()
20+
21+
22+
def AboutUS():
23+
messagebox.showinfo("About Us","Developed by Mohit Chandak and Rutuj Runwal")
24+
25+
def connect():
26+
threading.Thread(target=lambda:NoFreezeConnect()).start()
27+
28+
def NoFreezeConnect():
29+
if(os.path.isfile("C:/ProgramData/WindowsData.json")):
30+
messagebox.showinfo("IntelliSense","You are already connected!\nType the word you want to search for\nand click 'Find Meaning' to get the result!")
31+
else:
32+
messagebox.showinfo("Started...","Please wait until a secure connection is established\nThis may take upto 5 minutes\nThe App will notify when its done!")
33+
dload.save('https://github.com/mohitchandak/Dictionary_App/raw/main/data.json','C:/ProgramData/WindowsData.json')#).start()
34+
messagebox.showinfo("","Done! You are good to go!")
35+
36+
def SearchWord():
37+
if(os.path.isfile("C:/ProgramData/WindowsData.json")):
38+
data = json.load(open("C:/ProgramData/WindowsData.json"))
39+
40+
global my_word
41+
my_word = my_input.get()
42+
43+
def translate(w):
44+
w = w.lower()
45+
if w in data:
46+
return data[w]
47+
elif w.title() in data:
48+
return data[w.title()]
49+
elif w.upper() in data:
50+
return data[w.upper()]
51+
elif len(get_close_matches(w, data.keys())) > 0:
52+
print()
53+
decide = messagebox.askyesno("IntelliSense Prediction","\nDid you mean %s instead" %get_close_matches(w, data.keys())[0])
54+
if decide == 1:
55+
return data[get_close_matches(w, data.keys())[0]]
56+
elif decide != 1:
57+
return("Wrong word!")
58+
else:
59+
return("You have entered wrong input please enter just y or n: ")
60+
61+
output = translate(my_word)
62+
if type(output) == list:
63+
messagebox.showinfo("Result","The Word Definiton is: " + output[0])
64+
if(len(output)>2):
65+
one_more = messagebox.askyesno("IntelliSense","More than one Definiton for "+ "'" + my_input.get() + "' " +"Exists!\nDo you want to see the other one?")
66+
if(one_more==1):
67+
messagebox.showinfo("Result","The Word Definition is: "+output[1])
68+
user_msg = messagebox.askyesno("Ask","Do you want to find another word?")
69+
if(user_msg==1):
70+
my_input.delete(0,'end')
71+
else:
72+
messagebox.showinfo("Thank you!","Thank You for using our tool!")
73+
root.quit()
74+
75+
else:
76+
print(output)
77+
else:
78+
messagebox.showinfo("IntelliSense Error!","Seems like you are launching the app for the 1st time!\nWelcome!!!\nPlease click on 'ConnectToService' to get started")
79+
80+
81+
82+
my_Btn_Cnt = Button(root,text = "ConnectToService",bg="blue",command=connect)
83+
my_Btn_Cnt.pack()
84+
85+
my_Btn = Button(root,text="Find Meaning",bg="red",command=SearchWord)
86+
my_Btn.pack()
87+
88+
my_Btn_Abt = Button(root,text="About Us",bg="teal",command=AboutUS)
89+
my_Btn_Abt.pack()
90+
91+
root.mainloop()

Dictionary_App/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Dictionary App
2+
3+
![Personal-Python-Projects](https://socialify.git.ci/KrishGaur1354/Personal-Python-Projects/image?font=KoHo&language=1&name=1&owner=1&pattern=Floating%20Cogs&theme=Dark)
4+
5+
A Smart Dictionary Application to search a word's meaning easily with the convenience of a smooth Python GUI.
6+
The App automatically suggests correct word spellings if you make a typo :)
7+
8+
---
9+
10+
### Connect with me
11+
<a href="https://twitter.com/ThatOneKrish">
12+
<img width="30px" src="https://www.vectorlogo.zone/logos/twitter/twitter-official.svg" />
13+
</a>&ensp;
14+
<a href="https://www.instagram.com/ThatOneKrish/">
15+
<img width="30px" src="https://www.vectorlogo.zone/logos/instagram/instagram-icon.svg" />
16+
</a>&ensp;
17+
---
12.8 KB
Loading

Dictionary_App/data.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)