How to wait for response from modal window before continuing using tkinter? How to wait for response from modal window before continuing using tkinter? tkinter tkinter

How to wait for response from modal window before continuing using tkinter?


After some further digging, I found my own answer. The following does what I want. The function wait_window accepts a tkinter window and pauses until that window has been closed.

root = tk.Tk()modal = ModalWindow(root, 'Title', 'Text')root.wait_window(modal.modalWindow)if modal.choice == 'Yes':    # Do Something


I am missing something fundamental here. If the window is application-modal, you're forced to wait: there's nothing programmatic to be done. If you're trying to wait for an event that transpires in a window belonging to ANOTHER application, you're hosed unless you write some thorny OLE code (I assume Windows here, as UNIX way of doing things would never lead one eve to consider such a solution component).