Пример #1
0
 def click(x: int, y: int, button: str = "left") -> None:
     """Click at pixel xy."""
     # No need for checking if special keys are pressed down.
     # When game is out of focus they are not sent :)
     button = Inputs.btns[button]
     Com.set_cur_pos(x + Window.x, y + Window.y)
     win32gui.SendMessage(Window.id, button.down, button.btn, 0)
     win32gui.SendMessage(Window.id, button.up, button.btn, 0)
     time.sleep(userset.SHORT_SLEEP)
     Com.restore_cur()
Пример #2
0
 def click_drag(x: int, y: int, x2: int, y2: int, button: str = "left") -> None:
     """Simulate drag event from x, y to x2, y2"""
     button = Inputs.btns[button]
     Com.set_cur_pos(x + Window.cx, y + Window.cy)
     win32gui.SendMessage(Window.id, button.down, button.btn, 0)
     time.sleep(userset.SHORT_SLEEP)
     Com.set_cur_pos(x2 + Window.cx, y2 + Window.cy)
     win32gui.SendMessage(Window.id, wcon.WM_MOUSEMOVE, 0, 0)
     win32gui.SendMessage(Window.id, button.up, button.btn, 0)
     time.sleep(userset.SHORT_SLEEP)
     Com.restore_cur()
Пример #3
0
 def cursor_position(x: int, y: int) -> None:
     """Set cursor position to (x, y)"""
     Com.set_cur_pos(x + Window.cx, y + Window.cy)