function return value (based on what user clicksshowinfo always returns 'okaskokcancel ok--true askquestion yes--'yesno--'noaskretrycancel retry--true cancel or window closed--false askyesnocancel yes--true showerror always returns 'okshowwarning always returns 'okcancel or window closed--false no--false anything else--none destroying things to get rid of widgetuse its destroy method for instanceto get rid of button called buttondo the followingbutton destroy(to get rid of the entire gui windowuse the followingroot destroy(stopping window from being closed when your user tries to close the main windowyou may want to do somethinglike ask them if they really want to quit here is way to do thatfrom tkinter import from tkinter messagebox import askquestion def quitter_function()answer askquestion(title'quit'message'really quit'if answer='yes 'root destroy(root tk(root protocol'wm_delete_window 'quitter_functionmainloop(the key is the following linewhich cause quitter_function to be called whenever the user tries to close the window root protocol'wm_delete_window 'quitter_function updating tkinter updates the screen every so oftenbut sometimes that is not often enough for instancein function triggered by button presstkinter will not update the screen until the function is done