Quantcast
Viewing all articles
Browse latest Browse all 4776

Python • MousePosition with pyautogui does not return the correct value

Hi,
I try to get the mouse position on the whole screen with pyautogui.
The Raspberry pi 4 is completely updated with OS without any errors.

pyautogui is installed on a venv or directly with --break-system-packages option.

Both installations work fine, apart from the mouse position.
Looks like the position is stale in pyautogui. In the example - X: and Y: stay the same value, even when you move the mouse.
Other functions from pyautogui work fine.

Python version: 3.11.2
pyautogui: 0.9.54

example code:

Code:

import pyautogui, sysprint("pyautogui  : ",pyautogui.__version__)print("Screen size: ",pyautogui.size())pyautogui.alert("PyAutoGUI-Alert")x, y = pyautogui.position()print("X:",x," Y:",y)pyautogui.moveTo(100, 150)while True:x, y = pyautogui.position()print("X:",x," Y:",y)input("go on?")print("End")
It worked in the past fine, since I updated to the latest OS, it fail.
Any idea is welcome
regards,
HEP

Statistics: Posted by helle007 — Mon Jan 27, 2025 8:50 pm — Replies 0 — Views 33



Viewing all articles
Browse latest Browse all 4776

Trending Articles