Check the source code , Run the source file , Show test cases .
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("info", showinfo("Spam", "Egg Information"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("warning", showwarning("Spam", "Egg Warning"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("error", showerror("Spam", "Egg Alert"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("question", askquestion("Spam", "Question?"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("proceed", askokcancel("Spam", "Proceed?"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("yes/no", askyesno("Spam", "Got it?"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("yes/no/cancel", askyesnocancel("Spam", "Want it?"))
b.bind('<Button-1>',a)
root.mainloop()
from tkinter import *
from tkinter.messagebox import *
#1. create a window
root = Tk()
#2. Create and place components
b = Button(root,text=' Test pop up ')
b.pack()
#3. The binding event
def a(a):
print("try again", askretrycancel("Spam", "Try again?"))
b.bind('<Button-1>',a)
root.mainloop()