Tkinter MessageBox

Tkinter MessageBox widget is used to display message boxes in any applications in Python GUI. It provides many functions which can be used to display a message.

There are some Functions used in this widget:

  1. askquestion
  2. askyesno
  3. showwarning
  4. showerror
  5. showinfo
  6. askretrycancel
  7. askokcancel
Syntax:

The parameters FunctionName shows the name of the message box function. the title is the text of a title bar of the message box. the message is the text to be displayed as a message. options are alternative choices that can be used in the message box. Some options are default and parent.

Example:
from tkinter import *
from tkinter import messagebox


appWindow = Tk()
appWindow.title("Window Title-Tutorialsart.com")

appWindow.geometry('350x200')

def clicked():
    messagebox.showinfo('Messagebox Title', 'Message Information')
btn = Button(appWindow,text='Clickable Button', command=clicked, bg="orange")
btn.grid(column=0,row=0)
appWindow.mainloop()
Output:

17 Tkinter MessageBox

Comments are closed.