我正在構建一個從服務器接收命令的客戶端。(“TeamViewer”型別的程式)服務器發送按鍵事件和滑鼠坐標,客戶端運行它們。盡管當前除錯在同一臺計算機上運行,??但我希望在使用pyautogui.move(x,y)或時看到一些滑鼠移動pyautogui.press(char)。沒有看到任何移動,也沒有發生任何鍵盤按下。該函式exe()正在執行緒上運行并且作業正常(列印坐標作業正常)。
為什么pyautogui.move(x,y)或pyautogui.press(char)作業是這個代碼?
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")
uj5u.com熱心網友回復:
嘗試將x和轉換y為整數。
x = int(commandlist[1])
y = int(commandlist[2])
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/400102.html
上一篇:正則運算式匹配/中斷
下一篇:改變變數值的函式內函式
