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.45k stars 1.26k forks source link

Screenshots does not include the mouse cursor #693

Open syrull opened 2 years ago

syrull commented 2 years ago

It is notable to say in the documentation that the screenshots that the pyautogui is making or anything regarding the screenshots such as locateOnScreen and etc. does not include the mouse. I've been trying to figure out why certain things are not happening because it was based on cursor image which is not shown in the screenshot.

pendragons-code commented 2 years ago

Could I ask what platform you are using and if this affects users that use scrot?

jtranquilli commented 1 year ago

Has your cursor interacted with the browser? If you use moveTo() to move to the middle of the screen or to interact with something to ensure it is in the foreground of your screen? Otherwise it would make sense that the cursor isn't showing up in screenshots. A potential work around is to use the pyautogui.hotkey() function to take a screenshot that way. If you're on mac this would be pyautogui.hotkey('Cmd', 'Shift', '3') for example. This might work to avoid any issues inherent in pyautogui's screenshot method.

syrull commented 1 year ago

@pendragons-code @jtranquilli Forgive me for the late reply, the platform is Windows. There wasn't a browser interaction, and I've used it here: https://github.com/syrull/simple-fishing-bot

There is like 60 lines of code and with the README you will get an idea how I am using it.