由于某些未知原因,pyautogui "move" 和 "press" 函数没有 运行

pyautogui "move" and "press" function does not run for some unknown reason

我正在构建一个从服务器接收命令的客户端。 (一个“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")

尝试将 xy 转换为整数。

x = int(commandlist[1])
y = int(commandlist[2])