import time import win32gui,win32con import win32com.client class GoogleEarthControl: actions_map = {'move_left': win32con.VK_LEFT, 'move_right': win32con.VK_RIGHT, 'move_up': win32con.VK_UP, 'move_down': win32con.VK_DOWN, 'tilt_up': win32con.VK_PRIOR, 'tilt_down': win32con.VK_NEXT, 'zoom_in': win32con.WM_MOUSEWHEEL, 'zoom_out': win32con.WM_MOUSEWHEEL } def __init__(self): self.google_hwnd = get_input_window() def __getattr__(self, name): if name.startswith('do_'): try: return self.send_key(GoogleEarthControl.actions_map[name[3:]]) except KeyError: raise AttributeError(name) else: raise AttributeError(name) def send_key(self, key): win32gui.SendMessage(self.google_hwnd, win32con.WM_KEYDOWN, key, 0) win32gui.SendMessage(self.google_hwnd, win32con.WM_KEYUP, key, 0)