Programming

Wikipedia python Tkinter special project || Searching bar amazing GUI

2 Mins read

Wikipedia python Tkinter project || Searching bar GUI

Wikipedia Python Tkinter Project: Hello friends, as we know that python language is in high demand, python is a high level interpreted language which is very easy and has simple syntax and algorithms. So, with the help of python. We make the project “Search button” by using GUI(graphical user interference). Another Project such as the Login system in Python Tkinter.


What is the search button? We all have seen the Google search button. Whatever you search in GUI, the same here we will make with the help of the Wikipedia module. We will make a search button. Then you have not to use Wikipedia. You have to use your own folder and storage.

Let’s start coming to Wikipedia Python Tkinter Project 

Some tips for Wikipedia python Tkinter project

First we will import the modules and then we will make the window there we will make two frames, frame, and bottom frame. the frame contains an entry, label, and button and a function. a bottom frame contains a scrollbar, text, and button.

from tkinter import *
from tkinter import Scrollbar
import wikipedia
  • We are importing the Tkinter module of GUI and importing * means(anything).
  • In your machine importing the scrollbar module.
  • We are importing the Wikipedia python module. To import this make sure you have to already install it in your machine. When you have not installed this module. Open your python terminal or windows terminal and type here: python -m pip install Wikipedia.
Install Wikipedia module in python
  • Make sure you have to install the pip module…

check more about Wikipedia python module and the installation process or documentation click here…

top = Tk()
top.geometry('300x300')
top.title('search button')
top.configure(background='yellow')
  • We make here a top main window where everything works
  • top. The geometry creates a graph on the x and y-axis.
  • we provide title which will show on top.
frame = Frame(top,bg='yellow')
  • Here we are making a frame that will contain all the elements and this frame is creating in the top window.
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)

This is function will work when the button will press. E.get() is taking value which is written in Entry and Wikipedia.summary work on entry and whatever you search in the entry it will show in the text box.

l = Label(frame, text='Searched here', relief=GROOVE, font=('arial',15))
l.pack()
  • We create a label which shows on the top and relief generate border and label is packed.
E = Entry(frame, width=25, font=('arial',15),bd=6)
E.pack()
  • Entry is made and pack (it show entry in the window).
b = Button(frame,text = 'search',bd=5,bg='red',width=20,fg = 'blue',command=show)
b.pack()
  • Button is made and packed, here command is that without it button cannot work.
frame.pack()
  • Packed the frame

Recommended

bottomframe = Frame(top)
  • Make the bottom frame in the top window.
scroll = Scrollbar(bottomframe)
scroll.pack(side=RIGHT,fill =Y)
  • We make the scrollbar on the bottom frame and line
  • Then packed the scrollbar, side means align at the right side, and on the y-axis.
answer = Text(bottomframe,width = 30,bd=6,height=10,wrap = WORD,yscrollcommand = scroll.set)
answer.pack()
  • Make the text on the bottom frame with width=30, height=10 and scroll is set on the text and then the text is packed.
scroll.config(command=answer.yview)
bottomframe.pack()
  • Scrolls placed in the text at the y-axis.
  • The bottom frame is packed.
top.mainloop()
  • The main windows are closed.
Wikipedia python tkinter searching bar gui
  • Wikipedia python Tkinter project is completed now.
19 posts

About author
Writer
Articles
Related posts
Innovation & TechFreelancingProgrammingTechnology

How to become a Web Developer in 2022?

7 Mins read
So do you want to know how to become a web developer. Fortunately, there is no shortage of resources on the subject….
ProgrammingMachine Learning

Machine learning without code in the Browser: Human pose estimation

2 Mins read
This is great news for machine learning students. Google has launched a machine learning platform. Then this time you have to build…
Programming

Login page in python Tkinter with database: System Login Project

4 Mins read
login page in python Tkinter with database: System Login Project Today we have to develop a login page in Python Tkinter with…

Leave a Reply

Your email address will not be published. Required fields are marked *