The code below should continuously display the coordinates of the mouse. I am using Pycharm. When run in the terminal it works as intended, but when run using the "Run" command it does not display any output.
#! python3
# mouseNow.py - Displays the mouse cursor's current position.
import pyautogui
print('Press Ctrl-C to quit.')
try:
while True:
x, y = pyautogui.position()
positionStr = 'X:' +str(x).rjust(4)+' Y:'+str(y).rjust(4)
print(positionStr, end= '')
print('\b'*len(positionStr), end='',flush=True)
except KeyboardInterrupt:
print('\nDone.')
