简体   繁体   中英

How can I move my mouse in an application if the cursor is hidden?

I want to move my mouse to a set position in an application/game which hides the cursor. The movement works on all other applications like in a browser etc. But as soon as the cursor is not visible anymore, it won't move.

Right now I just use this:

pyautogui.click(a.index(b), hexcolpix.index(a), duration=1)

EDIT: check out this here if you do not understand my problem, these people have the same problem... https://www.anycodings.com/1questions/1159979/how-to-move-in-game-camera-using-python How to move 3D video game camera using Python?

Well, your cursor DOES move, but it is just hidden, you can use the moveTo() function to make the cursor move without clicking yet

pyautogui.moveTo(100, 200)   # moves mouse to X of 100, Y of 200.

then you can know the position of the cursor if you print it using the position() function

pyautogui.position()   # (160, 500) for example

This proves that the cursor moves even if it is hidden.

I recommend you to check the official documentation .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM