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:
- askquestion
- askyesno
- showwarning
- showerror
- showinfo
- askretrycancel
- 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()
Comments are closed.