def active_window(): id = _xautpy.active_window() if(id): win = window(id) return win else: return None
def wait_active(self, timeout = 0): import time sleep = .05 start = time.time() parent_id = _xautpy.find_outer_parent(self.id) while(1): active_id = _xautpy.active_window() active_parent_id = _xautpy.find_outer_parent(active_id) if(parent_id == active_parent_id): return True #A crude timeout function. Using threads and interrupts #is too complicated for such a simple loop. if(timeout > 0): now = time.time() if((now - start) >= timeout): return False time.sleep(sleep)
def is_active(self): active_id = _xautpy.active_window() return _xautpy.find_outer_parent(active_id) == _xautpy.find_outer_parent(self.id)
def is_active(self): active_id = _xautpy.active_window() return _xautpy.find_outer_parent( active_id) == _xautpy.find_outer_parent(self.id)