Python Tkinter MessageBox Widget Display Popup Message Box Window in Center Position After Button Clicked Full Example For Beginners

Python Tkinter MessageBox Widget Display Popup Message Box Window in Center Position After Button Clicked Full Example For Beginners

 

Welcome folks today in this blog post we will be looking on how to display a message box popup window to the user inside tkinter using messagebox widget in python. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

app.py

 

#.py producing a centred button
#andyp 12.10.13
import tkinter 
import tkinter.messagebox

app=tkinter.Tk()

def showMsgBx():
    tkinter.messagebox.showinfo('Hello Peeps','muppet')


app.title('Your Tkinter App')
app.geometry('450x100+200+100')

b1=tkinter.Button(app,text='click me!', width = 10,command =showMsgBx)
b1.pack()
app.mainloop()

 

 

Now if you execute the python script by typing the below command as shown below

 

python app.py

 

Leave a Reply