import tkinter.messagebox why we use code example

Example 1: python tkinter messagebox

import tkinter
from tkinter import messagebox
# hide main window
root = tkinter.Tk()
# message box display
messagebox.showerror("Error", "Error message")
messagebox.showwarning("Warning","Warning message")
messagebox.showinfo("Information","Informative message")

Example 2: tkinter messagebox

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()