Tkinter #8: Message Box in Tkinter
Message Box in Tkinter
In The Tkinter, the message box is used to display some questions, warnings, and some type of confirmation.
syntax
***********************
import tkinter.messagebx as msg
a = msg.name_of_options(options)
***********************
Name of options
MessageBox Widget
Python Tkinter – MessageBox Widget is used to display the message boxes in the python applications. This module is used to display a message using provides a number of functions.
Syntax:
messagebox.Function_Name(title, message [, options])
Parameters:
There are various parameters :
- Function_Name: This parameter is used to represents an appropriate message box function.
- title: This parameter is a string which is shown as a title of a message box.
- message: This parameter is the string to be displayed as a message on the message box.
- options: There are two options that can be used are:
- default: This option is used to specify the default button like ABORT, RETRY, or IGNORE in the message box.
- parent: This option is used to specify the window on top of which the message box is to be displayed.
Function_Name:
There are functions or methods available in the messagebox widget.
- showinfo(): Show some relevant information to the user.
- showwarning(): Display the warning to the user.
- showerror(): Display the error message to the user.
- askquestion(): Ask question and user has to answered in yes or no.
- askokcancel(): Confirm the user’s action regarding some application activity.
- askyesno(): User can answer in yes or no for some action.
- askretrycancel(): Ask the user about doing a particular task again or not.
Example:
Output:
Comments
Post a Comment