widget wait_window(winwidget wait_visibility(winthese tools pause the caller until tkinter variable changes its valuea window is destroyedor window becomes visible all of these enter local event loopsuch that the application' mainloop continues to handle events note that var is tkinter variable object (discussed earlier)not simple python variable to use for modal dialogsfirst call widget focus((to set input focusand widget grab((to make window be the only one activealthough we'll put some of these to work in exampleswe won' go into exhaustive details on all of these tools heresee other tk and tkinter documentation for more information using threads with tkinter guis keep in mind that for many programspython' thread support that we discussed in can serve some of the same roles as the tkinter tools listed in the preceding section and can even make use of them for instanceto avoid blocking gui (and its usersduring long-running file or socket transferthe transfer can simply be run in spawned threadwhile the rest of the program continues to run normally similarlyguis that must watch for inputs on pipes or sockets can do so in spawned threads or after callbacksor some combination thereofwithout blocking the gui itself if you do use threads in tkinter programshoweveryou need to remember that only the main thread (the one that built the gui and started the mainloopshould generally make gui calls at the leastmultiple threads should not attempt to update the gui at the same time for examplethe update method described in the preceding section has historically caused problems in threaded guis--if spawned thread calls this method (or calls method that does)it can sometimes trigger very strange and even spectacular program crashes in factfor simple and more vivid example of the lack of thread safety in tkinter guissee and run the following files in the book examples distribution package\pp \gui\tour\threads-demoall-frm py \pp \gui\tour threads-demoall-win py these scripts are takeoffs of the prior examples - and - which run the construction of four gui demo components in parallel threads they also both crash horrifically on windows and require forced shutdown of the program while some gui operations appear to be safe to perform in parallel threads ( see the canvas moves in example - )thread safety is not guaranteed by tkinter in general (for further proof of tkinter' lack of thread safetysee the discussion of threaded update loops in the next just after example - thread there that attempts to pop up new window also makes the gui fail resoundingly tkinter tourpart