from Tkinter import * from tkMessageBox import * def callback(): if askokcancel('Verify', 'Do you really want to quit?'): showwarning('Yes', 'Quit not yet implemented') else: showinfo('No', 'Quit has been canceled') errmsg ="Sorry, not allowed" Button(text='Quit', command=callback).pack(fill=X) Button(text='Hello', command=(lambda:showerror('Hello',errmsg))).pack(fill=X) mainloop()