I want to learn some reinforcement-learning concepts by letting my agent play a video game. In order to do so, I would like to control the mouse movement inside the game.
I've been fiddling with win32api , using win32api.SetCursorPos((x,y))
to move the mouse. While this works perfectly on my desktop, I can't find a way to translate the movement inside the game.
I have also tried using pyautogui with no luck either.
Any suggestions on how to solve this?
from pynput.mouse import Controller, Button
def clickAt(Mouse, x, y):
Mouse.position = (x, y)
Mouse.press(Button.right)
Mouse.release(Button.right)
Mouse = Controller()
clickAt(Mouse,100,100)
This is how you do it with pynput
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.