Skip to content

Commit 77eb063

Browse files
committed
Update wiki.py
1 parent d1eed79 commit 77eb063

File tree

1 file changed

+54
-49
lines changed

1 file changed

+54
-49
lines changed

wiki/wiki.py

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Made by abhra kanti Dubey
21
# In this program you ask it about any topic and it will show you the data from wikipedia
32
# pip install wikipedia
43

@@ -9,59 +8,65 @@
98
from tkinter import messagebox
109

1110

12-
root = tk.Tk()
13-
root.title("WIKIPEDIA SEARCH")
14-
root.geometry("1920x1080")
11+
class main():
12+
def __init__(self, root):
13+
self.root = root
1514

15+
self.root.title("WIKIPEDIA SEARCH")
16+
self.root.geometry("1920x1080")
1617

17-
def summary():
18-
query = wikipedia.page(question.get())
19-
answer = Text(
20-
root,
21-
height=100,
22-
width=160,
23-
font=("Arial", 14),
24-
wrap=WORD,
25-
bg="#7CEBC6",
26-
fg="black",
27-
)
28-
answer.insert(END, (query.summary))
29-
answer.pack()
18+
self.lbl1 = Label(
19+
root,
20+
text="WIKIPEDIA SUMMARY",
21+
font=("Verdana", 25, "bold"),
22+
width=50,
23+
bg="yellow",
24+
fg="red",
25+
relief=SOLID,
26+
)
27+
self.lbl1.pack(padx=10, pady=15)
3028

29+
self.question = StringVar()
3130

32-
lbl1 = Label(
33-
root,
34-
text="WIKIPEDIA SUMMARY TELLER BY ABHRA ",
35-
font=("Verdana", 25, "bold"),
36-
width=50,
37-
bg="yellow",
38-
fg="red",
39-
relief=SOLID,
40-
)
41-
lbl1.pack(padx=10, pady=15)
31+
self.quesbox = Entry(
32+
root,
33+
text="TELL ME YOUR QUESTION",
34+
font=("Verdana", 20, "italic"),
35+
width=80,
36+
textvariable=self.question,
37+
relief=GROOVE,
38+
bd=10,
39+
)
40+
self.quesbox.pack()
4241

43-
question = StringVar()
42+
self.searchbtn = Button(
43+
root,
44+
text="SEARCH",
45+
font=("Callibri", 18, "bold"),
46+
width=30,
47+
relief=GROOVE,
48+
bg="#4cd137",
49+
bd=3,
50+
command=self.summary,
51+
)
52+
self.searchbtn.pack()
4453

45-
quesbox = Entry(
46-
root,
47-
text="TELL ME YOUR QUESTION",
48-
font=("Verdana", 20, "italic"),
49-
width=80,
50-
textvariable=question,
51-
relief=GROOVE,
52-
bd=10,
53-
).pack()
54+
self.answer = Text(
55+
root,
56+
height=100,
57+
width=160,
58+
font=("Arial", 14),
59+
wrap=WORD,
60+
bg="#7CEBC6",
61+
fg="black",
62+
)
5463

55-
searchbtn = Button(
56-
root,
57-
text="SEARCH",
58-
font=("Callibri", 18, "bold"),
59-
width=30,
60-
relief=GROOVE,
61-
bg="#4cd137",
62-
bd=3,
63-
command=summary,
64-
).pack()
64+
def summary(self):
65+
self.query = wikipedia.page(self.question.get())
66+
self.answer.insert(END, (query.summary))
67+
self.answer.pack()
6568

66-
67-
root.mainloop()
69+
if __name__ == "__main__":
70+
root = tk.Tk()
71+
main(root)
72+
root.mainloop()

0 commit comments

Comments
 (0)