 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a message box with Tkinter?
In a particular application, we can create messagebox using messagebox method. Here is the list of messagebox we can create for a particular application,
- showinfo() - to show a general message on the screen. 
- showwarning() - to show the warning to the user. 
- showerror() - Display error message. 
- askquestion() - Query the user through the messagebox. 
- asktocancel() - Display the info to cancel an operation. 
- askretrycancel() - Display the message to prompt the user to retry again or not. 
Example
In this example, we will create an application that will show an info message box after clicking a button.
#Import required libraries from tkinter import * from tkinter import ttk from tkinter import messagebox #Create an instance of tkinter frame win= Tk() #Define the geometry of the window win.geometry("750x250") #Define a function to show the messagebox def handler():    messagebox.showinfo("Message", "You have clicked a Button") #Create a Label Label(win, text= "Click the below button", font=('Helvetica 16 underline')).pack(pady=20) #Create a Button ttk.Button(win, text= "Click", command= handler).pack(pady=30) win.mainloop()  Output
When we click the Button, it will show a messsagebox,
Advertisements
 