Skip to content

Commit 13ad844

Browse files
Merge pull request prathimacode-hub#472 from pratimakush10/wikipedia_summary
Wikipedia Summary
2 parents 36290e4 + 944eb57 commit 13ad844

File tree

6 files changed

+93
-0
lines changed

6 files changed

+93
-0
lines changed
1.94 MB
Loading
7.69 KB
Loading
45 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h3>Wikipedia Summary</h3>
2+
<hr>
3+
<h4>Built with</h4>
4+
<hr>
5+
<b>1.Python Tkinter</b><br>
6+
<b>2.Library needed</b><br>
7+
-- wikipedia - Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.<br>
8+
-- tkinter - Python provides the standard library Tkinter for creating the graphical user interface for desktop based applications.<br>
9+
-- tkinter – ScrolledText - There are various types of widgets available in Tkinter,ScrolledText widget is a text widget with a scroll bar.<br>
10+
The tkinter.scrolledtext module provides the text widget along with a scroll bar.
11+
<br>
12+
<h4>Aim</h4>
13+
<hr>
14+
The aim of this python script is to get the summary of desired topic from wikipedia.<br>
15+
<h4>Workflow of script</h4>
16+
<hr>
17+
Step 1: Firstly, imported all the package listed above.<br>
18+
Step 2: Then function name {search} will be there in which we get the data from wikipedia module.<br>
19+
Step 3: Then we create main window for tkinter,Buttons were added.<br>
20+
Step 4: 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.<br>
22+
<b>Don't forgot to connect your internet with the system.</b>
23+
<br>
24+
<h4>Output</h4>
25+
<hr>
26+
<b>output screenshot</b><br>
27+
GUIScripts/Wikipedia Summary/Images/output screenshot 1.png<br>
28+
GUIScripts/Wikipedia Summary/Images/output screenshot 2.png<br>
29+
<b>output gif</b><br>
30+
GUIScripts/Wikipedia Summary/Images/output.gif<br>
31+
<h4>Author</h4>
32+
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: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h3>Library Imported</h3>
2+
<hr>
3+
<b>1.wikipedia
4+
2.tkinter
5+
3.tkinter-ScrolledText
6+
<h4>Setup instructions</h4>
7+
<hr>
8+
-->To install:
9+
--1.wikipedia, simply run: <b>pip install wikipedia</b><br>
10+
<br>
11+
-- 2.tkinter : To install Tkinter, we need Python pre-installed.<br>
12+
Tkinter actually comes along when we install Python. While installing Python, we need to check the td/tk and IDLE checkbox.<br>
13+
This will install the tkinter and we need not install it separately.<br>
14+
<br>
15+
-- 3.tkinter-ScrolledText : just write {from tkinter import scrolledtext}<br>

0 commit comments

Comments
 (0)