The tkMessageBox module is utilized to exhibit message boxes in your applications. This unit offers a number of meanings that you can utilize to present a proper message. Some of these meanings are showinfo, showwarning, showerror, askquestion, askokcancel, askyesno, and askretryignore.
Here is the simple syntax to create this widget:
tkMessageBox.FunctionName(title, message [, options])
You could use one of the following functions with a dialogue box -
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:
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.