def getScreenPosition(obj): """ Fetches a TextInfo instance suitable for reviewing the screen, positioned at the given object's coordinates. @param obj: the NVDAObject to review @type obj: L{NVDAObject} @return: the TextInfo instance and the Scriptable object the TextInfo instance is referencing, or None on error. @rtype: (L{TextInfo},L{ScriptableObject}) """ focus = api.getFocusObject() while focus and not isinstance(focus, Window): focus = focus.parent if not focus: return None w = winUser.getAncestor(focus.windowHandle, winUser.GA_ROOT) or focus.windowHandle s = Window(windowHandle=w) if s: s.redraw() try: pos = DisplayModelTextInfo(s, obj) except LookupError: pos = DisplayModelTextInfo(s, textInfos.POSITION_FIRST) return pos, pos.obj