def switcher_focus_window(window: ui.Window): """Focus window and wait until switch is made""" window.focus() t1 = time.monotonic() while ui.active_window() != window: if time.monotonic() - t1 > 1: raise RuntimeError(f"Can't focus window: {window.title}") actions.sleep(0.1)
def switch_to_window(window: ui.Window): """Switch to the window at the given index""" window.focus() gui.hide()