I am building a client which receives commands from a server. (A "TeamViewer" type program)
The server sends keypress events and mouse coordinates and the client runs them.
although currently debugging is running on the same computer, I expect to see some mouse movement when I use pyautogui.move(x,y)
or pyautogui.press(char)
. No movement is seen and no keyboard press is happening.
The function exe()
is running on a thread and is working properly (printing the coordinates works fine).
Why does pyautogui.move(x,y)
or pyautogui.press(char)
work is this code?
def exe():
while True:
if executeQ:
command = executeQ.get()
commandlist = command.split('\n')
char = commandlist[0]
x = commandlist[1] #getting command
y = commandlist[2]
try:
print(f'Typing - {char}')
pyautogui.press(char)
except:
pass
try:
print(f'Moving to - {x},{y}')
pyautogui.move(x,y)
except:
print("OUT OF BOUNDS / SAME POSOTION")
CodePudding user response:
Try to convert x
and y
to integers.
x = int(commandlist[1])
y = int(commandlist[2])