Skip to content

Commit aa9cbee

Browse files
committed
wikipedia_summary
1 parent 6135876 commit aa9cbee

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed
1.94 MB
Loading
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h3>Wikipedia Summary</h3>
2+
<hr>
3+
<h4>Package needed</h4>
4+
<hr>
5+
-- wikipedia - Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.<br>
6+
-- tkinter - Python provides the standard library Tkinter for creating the graphical user interface for desktop based applications.<br>
7+
-- tkinter – ScrolledText - There are various types of widgets available in Tkinter,ScrolledText widget is a text widget with a scroll bar.<br>
8+
The tkinter.scrolledtext module provides the text widget along with a scroll bar.<br>
9+
<h4>Setup instructions</h4>
10+
<hr>
11+
-- To install Wikipedia, simply run: <b>pip install wikipedia</b><br>
12+
<br>
13+
-- tkinter : To install Tkinter, we need Python pre-installed.<br>
14+
Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox.<br>
15+
This will install the tkinter and we need not install it separately.<br>
16+
<br>
17+
-- tkinter-ScrolledText : just write {from tkinter import scrolledtext}<br>
18+
<h4>Explanation of script</h4>
19+
<hr>
20+
Firstly, import all the package listed above. Then function name search will be there in which we get the data from wikipedia using module.Then we create main<br> window for tkinter.Buttons were added,When we run the script tkinter interface will appear we write the topic in space given.Click on search then wait for a while<br>
21+
then summary will appear.<b>Don't forget to connect to internet</b><br>
22+
<br>
23+
<h4>Output</h4>
24+
<hr>
25+
![output](https://user-images.githubusercontent.com/81240664/123242401-9ff03280-d4ff-11eb-9623-ccb431279cac.gif)
26+
<br>
27+
<h4>Author</h4>
28+
Pratima Kushwaha
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from tkinter import *
2+
from tkinter.scrolledtext import ScrolledText
3+
import wikipedia as wiki
4+
5+
def search():
6+
search_data = ent.get()
7+
data = wiki.summary(search_data)
8+
#delete current data
9+
ent.set('')
10+
text.delete(0.0,END)
11+
#INSERT DATA
12+
search_lbl['text'] = 'Topic to be search given by user is....{}'.format(search_data)
13+
text.insert(0.0,data)
14+
15+
root = Tk()
16+
17+
#adding icon
18+
p1 = PhotoImage(file = r'C:\Users\HP\Downloads\wiki.png')
19+
root.iconphoto(False, p1)
20+
#giving title to gui
21+
root.title('Wikipedia Summary')
22+
root.geometry('500x680')
23+
root.configure(bg='white')
24+
25+
ent = StringVar()
26+
27+
search_entry = Entry(root,font=('arial',15),bd=2,relief=RIDGE,textvariable=ent)
28+
search_entry.place(x=15,y=11,height=32,width=350)
29+
30+
search_lbl = Label(root,text='Topic to be search given by user is....',font=('arial',12,'bold'),bg='white')
31+
search_lbl.place(x=15,y=65)
32+
33+
text = ScrolledText(root,font=('times',18),bd=4,relief=SUNKEN,wrap = WORD)
34+
text.place(x=15,y=100,height=480,width=480)
35+
36+
search_btn = Button(root,text='search',font=('arial',12,'bold'),width=10,command=search)
37+
search_btn.place(x=380,y=11)
38+
39+
clear_btn = Button(root,text='Clear',font=('arial',12,'bold'),width=10,command=lambda :text.delete(0.0,END))
40+
clear_btn.place(x=105,y=590)
41+
42+
exit_btn = Button(root,text='Exit',font=('arial',12,'bold'),width=10,command=root.quit)
43+
exit_btn.place(x=220,y=590)
44+
45+
46+
root.mainloop()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<h3>Package needed</h3>
2+
<hr>
3+
1. wikipedia
4+
--pip install wikipedia
5+
<br>
6+
2.Install Tkinter
7+
Tkinter can be installed using pip. The following command is run in the command prompt to install Tkinter.<br>
8+
<br>
9+
--pip install tk<br>
10+
This command will start downloading and installing packages related to the Tkinter library. Once done, the message of successful installation will be displayed.<br>
11+
<br>
12+
3.tkinter-ScrolledText : just write {from tkinter import scrolledtext}

0 commit comments

Comments
 (0)