eng
competition

Text Practice Mode

Python programming - Making a Wikipedia browser

created Wednesday January 13, 11:39 by Raj Singh Chauhan


1


Rating

102 words
27 completed
00:00
from tkinter import *
from tkinter import Scrollbar
import wikipedia
 
top = Tk()
top.geometry('300x300')
top.title('search button')
top.configure(background='yellow')
frame = Frame(top, bg='yellow')
 
 
def show():
    entry = E.get()
    answer.delete(1.0, END)
    try:  # TRY use for remove the error
        answer_value = wikipedia.summary(entry)
    except:
        answer.insert(
            INSERT, 'please enter correct keyword or check your internet connection')
        answer.insert(INSERT, answer_value)
 
 
l = Label(frame, text='Searched here', relief=GROOVE, font=('arial', 15))
l.pack()
E = Entry(frame, width=25, font=('arial', 15), bd=6)
E.pack()
b = Button(frame, text='search', bd=5, bg='red',
           width=20, fg='blue', command=show)
b.pack()
frame.pack()
bottomframe = Frame(top)
scroll = Scrollbar(bottomframe)
scroll.pack(side=RIGHT, fill=Y)
answer = Text(bottomframe, width=30, bd=6, height=10,
              wrap=WORD, yscrollcommand=scroll.set)
answer.pack()
scroll.config(command=answer.yview)
bottomframe.pack()
top.mainloop()
 

saving score / loading statistics ...