Skip to content

Commit 5fa07a0

Browse files
authored
Add files via upload
Dictionary in python using tkinker library
1 parent 828cde5 commit 5fa07a0

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Dictionary.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from tkinter import *
2+
import tkinter
3+
from PIL import Image,ImageTk
4+
import json
5+
from difflib import get_close_matches
6+
7+
8+
data=open("data.json",)
9+
data_load=json.load(data)
10+
11+
def search (word):
12+
if word in data_load:
13+
meaning_word.delete(1.0,END)
14+
meaning_word.config(fg="red")
15+
meaning_word.insert(END,data_load[word])
16+
elif(len(get_close_matches(word,data_load.keys())))>0:
17+
meaning_word.config(fg=("red"))
18+
meaning_word.delete(1.0,END)
19+
meaning_word.insert(END,"WERE YOU FINDING {} MEANING OF THAT PARTICULAR WORD:{}.".format(get_close_matches(word,data_load.keys())[0],data_load[get_close_matches(word,data_load.keys())[0]]))
20+
21+
final=get_close_matches(word,data_load.keys())
22+
root=Tk()
23+
root.title("MY DICTIONARY")
24+
25+
26+
image=Image.open('dict.png')
27+
image_picture=ImageTk.PhotoImage(image)
28+
dest_pic=Label(root,image=image_picture)
29+
dest_pic.pack()
30+
31+
a=StringVar()
32+
33+
word_meaning=Entry(root,textvariable=a,background="blue",fg="white",font=("Arial",40,"bold"))
34+
word_meaning.place(relx=.185,rely=.70,relwidth=.75,relheight=.082)
35+
36+
button1=Button(root,text="Search The Word For",command=lambda:search(a.get()),background="red",fg="white",font=('Arial',40,"bold"))
37+
button1.place(relx=.25,rely=.80,relwidth=.50,relheight=.052)
38+
39+
meaning_word=Text(root,background="white",font=("Arial",25,"bold"))
40+
meaning_word.place(relx=.200,rely=.05,relwidth=.63,relheight=.16)
41+
42+
43+
root.mainloop()

0 commit comments

Comments
 (0)