Skip to content

Commit b4a222e

Browse files
authored
Added comments in english_dictionary.py
1 parent 23ace63 commit b4a222e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
from tkinter import *
1+
from tkinter import * #importing the necessary libraries
22
import json
33
from difflib import get_close_matches
44

5-
data = json.load(open("Related/data.json"))
5+
data = json.load(open("Related/data.json")) #loading and storing the data from json file
66

77
def search(word):
8-
if word in data:
8+
if word in data: #if the typed word is present in the data
99
t1.delete(1.0,END)
1010
t1.config(fg='white')
1111
t1.insert(END,data[word])
12-
elif len(get_close_matches(word,data.keys()))>0:
12+
elif len(get_close_matches(word,data.keys()))>0: #if the typed word is not found in data or is misspelled
1313
t1.config(fg='red')
1414
t1.delete(1.0,END)
1515
t1.insert(END,"Did you mean {} to mean : {} ".format (get_close_matches(word,data.keys())[0],data[get_close_matches(word,data.keys())[0]]))
@@ -23,17 +23,15 @@ def search(word):
2323
label.pack()
2424

2525
e1_value=StringVar()
26-
e1 = Entry(window,textvariable=e1_value,bg="black",fg="white",justify = CENTER,font = ('courier', 30, 'bold'))
26+
e1 = Entry(window,textvariable=e1_value,bg="black",fg="white",justify = CENTER,font = ('courier', 30, 'bold')) #for the text bar
2727
e1.place(relx=.185,rely=0.70,relwidth=.63,relheight=.082)
2828

2929

30-
b1 = Button(window,text="Search",command= lambda : search(e1_value.get()),relief=FLAT,bg="black",fg="white",font = ('courier', 30, 'bold') )
30+
b1 = Button(window,text="Search",command= lambda : search(e1_value.get()),relief=FLAT,bg="black",fg="white",font = ('courier', 30, 'bold') ) #for the search button
3131
b1.place(relx=.40,rely=.85,relwidth=.2,relheight=.052)
3232

3333

34-
t1 = Text(window,fg="white",relief=FLAT,bg="#444444",font = ('courier', 20, 'bold'))
34+
t1 = Text(window,fg="white",relief=FLAT,bg="#444444",font = ('courier', 20, 'bold')) #for displaying the meaning
3535
t1.place(relx=.185,rely=.09,relwidth=.63,relheight=.50)
3636

37-
38-
39-
window.mainloop()
37+
window.mainloop()

0 commit comments

Comments
 (0)