0% found this document useful (0 votes)
67 views2 pages

TK Messagebox

Pour apprendre à coder et utiliser les messagebox avec beaucoup de précision

Uploaded by

Antonio Binga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views2 pages

TK Messagebox

Pour apprendre à coder et utiliser les messagebox avec beaucoup de précision

Uploaded by

Antonio Binga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON TKINTER TKMESSAGEBOX

http://www.tutorialspoint.com/python/tk_messagebox.htm Copyright © tutorialspoint.com

The tkMessageBox module is used to display message boxes in your applications. This module
provides a number of functions that you can use to display an appropriate message.

Some of these functions are showinfo, showwarning, showerror, askquestion, askokcancel,


askyesno, and askretryignore.

Syntax
Here is the simple syntax to create this widget −

tkMessageBox.FunctionName(title, message [, options])

Parameters
FunctionName: This is the name of the appropriate message box function.

title: This is the text to be displayed in the title bar of a message box.

message: This is the text to be displayed as a message.

options: options are alternative choices that you may use to tailor a standard message box.
Some of the options that you can use are default and parent. The default option is used to
specify the default button, such as ABORT, RETRY, or IGNORE in the message box. The parent
option is used to specify the window on top of which the message box is to be displayed.

You could use one of the following functions with dialogue box −

showinfo

showwarning

showerror

askquestion

askokcancel

askyesno

askretrycancel

Example
Try the following example yourself −

import Tkinter
import tkMessageBox

top = Tkinter.Tk()
def hello():
tkMessageBox.showinfo("Say Hello", "Hello World")

B1 = Tkinter.Button(top, text = "Say Hello", command = hello)


B1.pack()

top.mainloop()

When the above code is executed, it produces the following result −


Loading [MathJax]/jax/output/HTML-CSS/jax.js

You might also like