showinfo('no''quit has been cancelled'errmsg 'sorryno spam allowed!button(text='quit'command=callbackpack(fill=xbutton(text='spam'command=(lambdashowerror('spam'errmsg))pack(fill=xmainloop( lambda anonymous function is used here to wrap the call to showerror so that it is passed two hardcoded arguments (rememberbutton-press callbacks get no arguments from tkinter itselfwhen runthis script creates the main window in figure - figure - dlg main windowbuttons to trigger pop ups when you press this window' quit buttonthe dialog in figure - is popped up by calling the standard askyesno function in the tkinter package' messagebox module this looks different on unix and macintosh systemsbut it looks like you' expect when run on windows (and in fact varies its appearance even across different versions and configurations of windows--using my default window setupit looks slightly different than it did on windows xp in the prior editionthe dialog in figure - blocks the program until the user clicks one of its buttonsif the dialog' yes button is clicked (or the enter key is pressed)the dialog call returns with true value and the script pops up the standard dialog in figure - by calling showwarning figure - dlg askyesno dialog (windows dialogs