asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.12k stars 1.23k forks source link

Mouse cursor doesn't visually move on GNOME. #282

Open asweigart opened 5 years ago

asweigart commented 5 years ago

This issue was brought up by this StackOverflow post: https://stackoverflow.com/questions/53231971/pyautogui-does-not-move-the-actual-mouse-pointer

The moveTo() function will "move" the cursor (as determined by subsequent calls to position()) but the displayed cursor remains in the same place. This happens on GNOME in Ubuntu 18.04.1 LTS

executionByFork commented 5 years ago

Thank you for pushing this problem. That's my question and I opened up an issue here: #279

dchen327 commented 5 years ago

This issue was brought up by this StackOverflow post: https://stackoverflow.com/questions/53231971/pyautogui-does-not-move-the-actual-mouse-pointer

The moveTo() function will "move" the cursor (as determined by subsequent calls to position()) but the displayed cursor remains in the same place. This happens on GNOME in Ubuntu 18.04.1 LTS

Was a fix ever found for this issue? I am running Crostini on a chromebook and am having the exact same issue.

executionByFork commented 5 years ago

I did not find a fix

dchen327 commented 5 years ago

I did not find a fix

In my case I have been informed that Crostini simply does not have access to mouse and screen functions. This is a security feature, so I don't think it pyautogui will be working anytime soon. Have you tried any other methods (maybe another programming language)?

executionByFork commented 5 years ago

I ended up working around pyautogui's failure by using the PIL library and manually programming in checks for various pixels in order to identify images. This is obviously not the greatest solution, and is prone to break in the future, but since my game bot was just a side project of mine, it's not as bad as using this method in production.

I do hope sometime in the near future that this issue will be resolved though. It's clear this is something that will cause many issues for many users, and I would like to implement the robust solution that pyautogui promises with it's image recognition library

GurjeetSahu commented 1 year ago

Switching to xorg worked for me https://stackoverflow.com/a/65528590/14599124