The Python gui-tkinter tkmessagebox:tkmessagebox module is used to display message boxes in your application. This module provides a feature that you can use to display the appropriate message
The Tkmessagebox module is used to display message boxes in your application. This module provides a feature that you can use to display the appropriate message.
Some of these features are showinfo,showwarning,showerror,askquestion,askokcancel,askyesno,askretryignore.
Method:
Here is a simple syntax to create this widget:
Tkmessagebox.functionname (title, message [, Options])
Parameters:
FunctionName: This is the name of the corresponding message box function.
Title: This is the text that is displayed in a message box in the title bar.
Message: This is the text to display as messages.
Options: Option has an alternative that you can use to customize a standard message box. Some of the options you can use are default and parent. The default option is to specify the default button, such as Abort, retry, or ignore in the message box. The parent option is used to specify the top-level window on the message box to display.
You can use one of the following features of the dialog box:
Showinfo ()
Showwarning ()
ShowError ()
Askquestion ()
Askokcancel ()
AskYesNo ()
Askretrycancel ()
Example:
Try the following example yourself:
Import Tkinterimport tkmessageboxtop = tkinter.tk () def hello (): tkmessagebox.showinfo ("Say hello", "Hello World") B1 = Tkinter.button (top, Text = "Say Hello", command = Hello) b1.pack () Top.mainloop ()
This will produce the following results:
Python Gui-tkinter Tkmessagebox