'Why isn't pyautogui tracking the coordinates of my mouse?
I've tried everything and pyautogui isn't tracking my mouse in pycharm
I've tried:
import pyautogui
print(pyautogui.position())
import pyautogui
while True:
print(pyautogui.position())
and I've tried
import pyautogui as lms
getinfo = currentMouseX, currentMouseY = lms.position()
print(getinfo)
and nothing is working. Again, I'm using pycharm and python 3 but I don't think that matters.
Solution 1:[1]
Try the following code :
while True:
x, y = pyautogui.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
print(positionStr, end='')
time.sleep(0.05)
print('\b' * len(positionStr), end='', flush=True)
Sleep used for printing results otherwise results may show up in 'delay' ( it's not delay its the opposite to fast to show ) also the print formatted in convenient way
Solution 2:[2]
I fixed it. I just had to re-install pycharm. Thanks for everyone's help though
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Midnight |
