If you use something like this:
import Tkinter root = Tkinter.Tk() root.bind('<space>', lambda e: root.quit())
and not: root.destroy() , then the quit method will kill the Tcl interpreter, which will not just exit mainloop and remove all widgets. So, once you call root.quit() , you can be sure that your root completely dead!
All other methods you have proposed (for example: wminfo_exists() ) are available only when at least one valid Tk exists.
Note:
If you use more than one mainloop, you must use the destroy method to ensure that your main mainlop will not be killed - but I donβt think this is your case.
source share