example - uses the prior example' makeform and fetch functions to generate form and prints its contentsmuch as before herethoughthe input fields are attached to new toplevel pop-up window created on demandand an ok button is added to the new window to trigger window destroy event that erases the pop up as we learned earlierthe wait_window call pauses until the destroy happens example - pp \gui\tour\entry -modal py make form dialog modalmust fetch before destroy with entries from tkinter import from entry import makeformfetchfields def show(entriespopup)fetch(entriespopup destroy(must fetch before window destroyedfails with msgs if stmt order is reversed def ask()popup toplevel(show form in modal dialog window ents makeform(popupfieldsbutton(popuptext='ok'command=(lambdashow(entspopup))pack(popup grab_set(popup focus_set(popup wait_window(wait for destroy here root tk(button(roottext='dialog'command=askpack(root mainloop(when you run this codepressing the button in this program' main window creates the blocking form input dialog in figure - as expected but subtle danger is lurking in this modal dialog codebecause it fetches user inputs from entry widgets embedded in the popped-up displayit must fetch those inputs before destroying the pop-up window in the ok press callback handler it turns out that destroy call really does destroy all the child widgets of the window destroyedtrying to fetch values from destroyed entry not only doesn' workbut also generates traceback with error messages in the console window try reversing the statement order in the show function to see for yourself message and entry