mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-27 14:01:12 +00:00
#338 Created GUI_Dictionary
This commit is contained in:
parent
00a7e6ee14
commit
7110257a25
54
scripts/GUI_Dictionary/GUI_Dictionary.py
Normal file
54
scripts/GUI_Dictionary/GUI_Dictionary.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
from tkinter import *
|
||||
from tkinter import messagebox
|
||||
from PyDictionary import PyDictionary
|
||||
|
||||
|
||||
root = Tk()
|
||||
root.title("GUI Dictionary")
|
||||
root.geometry("500x400")
|
||||
|
||||
|
||||
dictionary = PyDictionary()
|
||||
|
||||
|
||||
def getMeaning():
|
||||
response = dictionary.meaning(word.get())
|
||||
if (response):
|
||||
if ('Noun' in response):
|
||||
meaning = response['Noun'][0]
|
||||
elif ('Verb' in response):
|
||||
meaning = response['Verb'][0]
|
||||
elif ('Adjective' in response):
|
||||
meaning = response['Adjective'][0]
|
||||
else:
|
||||
meaning = "Invalid word"
|
||||
else:
|
||||
messagebox.showinfo(
|
||||
"Error", "Please add a Noun, Pronoun, verb or a valid word.")
|
||||
meaning_label.config(text=meaning)
|
||||
|
||||
|
||||
|
||||
heading_label = Label(root, text="DICTIONARY", font=("Times 35 bold"), foreground='dark blue')
|
||||
heading_label.config(anchor=CENTER)
|
||||
heading_label.pack(pady=10)
|
||||
|
||||
|
||||
frame = Frame(root)
|
||||
Label(frame, text="Enter Word", font=("Helvetica 15 bold"), foreground='dodger blue').pack(side=LEFT)
|
||||
word = Entry(frame, font=("Helvetica 15 bold"))
|
||||
word.pack(padx=10)
|
||||
frame.pack()
|
||||
|
||||
search_button = Button(root, text="Search Word", font=("arial 15 bold"), relief=RIDGE, borderwidth=3, cursor="hand2", foreground='Magenta', command=getMeaning)
|
||||
search_button.config(anchor=CENTER)
|
||||
search_button.pack(pady=10)
|
||||
|
||||
|
||||
frame1 = Frame(root)
|
||||
Label(frame1, text="Meaning : ", font=("Helvetica 15 bold"), foreground='medium turquoise').pack(side=LEFT)
|
||||
meaning_label = Label(frame1, text="", font=("Helvetica 12"))
|
||||
meaning_label.pack(pady=5)
|
||||
frame1.pack(pady=10)
|
||||
|
||||
root.mainloop()
|
24
scripts/GUI_Dictionary/README.md
Normal file
24
scripts/GUI_Dictionary/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Dictionary GUI
|
||||
This script lets the user search for the meaning of words like a dictionary.
|
||||
|
||||
## Setup instructions
|
||||
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 for the project.
|
||||
```
|
||||
pip install PyDictionary
|
||||
```
|
||||
|
||||
After satisfying all the requirements for the project, Open the terminal in the project folder and run
|
||||
```
|
||||
python GUI_Dictionary.py
|
||||
```
|
||||
or
|
||||
```
|
||||
python3 GUI_Dictionary.py
|
||||
```
|
||||
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.
|
||||
|
||||
# Introducing to Interface
|
||||
<img src="screenshots/gui_dict1.png">
|
||||
<br>
|
||||
<img src="screenshots/gui-dict-3.png"><br>
|
||||
<img src="screenshots/gui-dict-4.png">
|
BIN
scripts/GUI_Dictionary/screenshots/gui-dict-3.png
Normal file
BIN
scripts/GUI_Dictionary/screenshots/gui-dict-3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
scripts/GUI_Dictionary/screenshots/gui-dict-4.png
Normal file
BIN
scripts/GUI_Dictionary/screenshots/gui-dict-4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
scripts/GUI_Dictionary/screenshots/gui_dict1.png
Normal file
BIN
scripts/GUI_Dictionary/screenshots/gui_dict1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Loading…
Reference in New Issue
Block a user