Wait until the visibility state of window changes, for example when it first appears on the screen, continuing to process events in the meantime. If window is omitted, this widget is used. This is typically used to wait for a newly created window to become visible before acting on it.