Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 177f52b

Browse files
Merge pull request avinashkranjan#735 from Ayushjain2205/dictionary-gui
Dictionary GUI
2 parents 40bfe41 + 0d703ab commit 177f52b

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

‎Dictionary-GUI/README.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dictionary GUI
2+
This script lets the user search for the meaning of words like a dictionary.
3+
4+
## Setup instructions
5+
In order to run this script, you need to have Python and pip installed on your system. After you're done installing Python and pip, run the following command from your terminal to install the requirements from the same folder (directory) of the project.
6+
```
7+
pip install -r requirements.txt
8+
```
9+
10+
After satisfying all the requirements for the project, Open the terminal in the project folder and run
11+
```
12+
python dictionary.py
13+
```
14+
or
15+
```
16+
python3 dictionary.py
17+
```
18+
depending upon the python version. Make sure that you are running the command from the same virtual environment in which the required modules are installed.
19+
20+
## Output
21+
![Sample output of dictionary script](https://i.postimg.cc/BvHqZDkz/dictionary1.png)
22+
![Sample output of dictionary script](https://i.postimg.cc/jSJTvPxj/dictionary2.png)
23+
24+
## Author
25+
[Ayush Jain](https://github.com/Ayushjain2205)

‎Dictionary-GUI/dictionary.py‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from tkinter import *
2+
from tkinter import messagebox
3+
from PyDictionary import PyDictionary
4+
5+
# Creating Tkinter Scaffold
6+
root = Tk()
7+
root.title("Dictionary")
8+
root.geometry("500x400")
9+
10+
# Initialize dictionary objecy
11+
dictionary = PyDictionary()
12+
13+
def getMeaning():
14+
response=dictionary.meaning(word.get())
15+
if(response):
16+
if('Noun' in response):
17+
meaning=response['Noun'][0]
18+
elif('Verb' in response):
19+
meaning=response['Verb'][0]
20+
elif('Adjective' in response):
21+
meaning=response['Adjective'][0]
22+
else:
23+
meaning="Invalid word"
24+
else:
25+
messagebox.showinfo("Error","Please add a Noun, Pronoun, verb or a valid word.")
26+
# Show meaning in frame
27+
meaning_label.config(text=meaning)
28+
29+
30+
# Heading Label
31+
heading_label = Label(root, text = "DICTIONARY", font=("Helvetica 35 bold"),foreground='Blue')
32+
heading_label.config(anchor=CENTER)
33+
heading_label.pack(pady=10)
34+
35+
# Frame for search box and search button
36+
frame = Frame(root)
37+
Label(frame, text="Enter Word", font=("Helvetica 15 bold")).pack(side=LEFT)
38+
word = Entry(frame, font=("Helvetica 15 bold"))
39+
word.pack(padx=10)
40+
frame.pack()
41+
42+
search_button=Button(root, text="Search Word",font=("Helvetica 15 bold"),relief=RIDGE,borderwidth=3,cursor="hand2",foreground='Green', command=getMeaning)
43+
search_button.config(anchor=CENTER)
44+
search_button.pack(pady=10)
45+
46+
# Frame to display meaning
47+
frame1 = Frame(root)
48+
Label(frame1, text="Meaning : ", font=("Helvetica 15 bold")).pack(side=LEFT)
49+
meaning_label = Label(frame1, text="", font=("Helvetica 12"))
50+
meaning_label.pack(pady=5)
51+
frame1.pack(pady=10)
52+
53+
# Execute Tkinter
54+
root.mainloop()

‎Dictionary-GUI/requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PyDictionary

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /