Project 1 - English Dictionary App & Library Book Management System
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"id": "8f4db653",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ramp:\n",
"Noun:\n",
"an inclined surface connecting two levels\n",
"North American perennial having a slender bulb and whitish flowers\n",
"a movable staircase that passengers use to board or leave an aircraft\n",
"Verb:\n",
"behave violently, as if in state of a great anger\n",
"furnish with a ramp\n",
"be rampant\n",
"creep up -- used especially of plants\n",
"stand with arms or forelegs raised, as if menacing\n",
"None\n",
"<class 'NoneType'>\n"
]
}
],
"source": [
"from tkinter import *\n",
"from PyDictionary import PyDictionary\n",
"import json\n",
"window=Tk()\n",
"window.geometry('250x200')\n",
"\n",
"def add(): \n",
" file = open(\"words.txt\",\"w\")\n",
" word=entry.get()\n",
" file.write(word)\n",
" file.close() \n",
"\n",
"def find_meaning():\n",
" word=entry.get()\n",
" dictionary=PyDictionary(word)\n",
" meaning=dictionary.printMeanings()\n",
" print(meaning)\n",
" print(type(meaning)) \n",
"\n",
"def update():\n",
" file = open('words.txt',\"w\")\n",
" word=entry.get()\n",
" json.dump(word,file)\n",
" file.close()\n",
"\n",
"entry=Entry(window,font=(\"times\",15,\"bold\"))\n",
"entry.grid(row=2,column=2)\n",
"b1=Button(window,text=\"Add a new word\",command=add)\n",
"b1.grid(row=4,column=2)\n",
"b2=Button(window,text=\"Find meaning\",command=find_meaning)\n",
"b2.grid(row=6,column=2)\n",
"b3=Button(window,text=\"UPDATE\",command=update)\n",
"b3.grid(row=8,column=2)\n",
"b4=Button(window,text=\"Exit\",command=window.destroy)\n",
"b4.grid(row=10,column=2)\n",
"\n",
"window.mainloop()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2437755e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}