modal dialogs are typically implemented by waiting for newly created pop-up window' destroy eventas in this example but other schemes are viable too for exampleit' possible to create dialog windows ahead of timeand show and hide them as needed with the top-level window' deiconify and withdraw methods (see the alarm scripts near the end of for detailsgiven that window creation speed is generally fast enough as to appear instantaneous todaythis is much less common than making and destroying window from scratch on each interaction it' also possible to implement modal state by waiting for tkinter variable to change its valueinstead of waiting for window to be destroyed see this later discussion of tkinter variables (which are class objectsnot normal python variablesand the wait_variable method discussed near the end of for more details this scheme allows long-lived dialog box' callback handler to signal state change to waiting main programwithout having to destroy the dialog box finallyif you call the mainloop method recursivelythe call won' return until the widget quit method has been invoked the quit method terminates mainloop calland so normally ends gui program but it will simply exit recursive mainloop level if one is active because of thismodal dialogs can also be written without wait method calls if you are careful for instanceexample - works the same way as the modal mode of dlg-custom example - pp \gui\tour\dlg-recursive py from tkinter import def dialog()win toplevel(label(wintext='hard drive reformatted!'pack(button(wintext='ok'command=win quitpack(win protocol('wm_delete_window'win quitwin focus_set(win grab_set(win mainloop(win destroy(print('dialog exit'make new window add few widgets set quit callback quit on wm close tootake over input focusdisable other windows while ' openand start nested event loop to wait root tk(button(roottext='popup'command=dialogpack(root mainloop(if you go this routebe sure to call quit rather than destroy in dialog callback handlers (destroy doesn' terminate the mainloop level)and be sure to use protocol to make the window border close button call quit too (or else it won' end the recursive mainloop level call and may generate odd error messages when your program finally exitsbecause of this extra complexityyou're probably better off using wait_window or wait_variablenot recursive mainloop calls tkinter tourpart