当文件转换为 .exe

问题描述

我正在尝试检测鼠标额外按钮(Button.X1 和 Button.X2)。当文件是 .py 时,我能够实际看到按钮被按下。但是,当我将它作为 .exe 运行时,这似乎不起作用。它在鼠标和键盘侦听器中都有打印语句,但不提供任何输出。我也尝试过使用 py2exe 和 pyinstaller 进行转换。

def on_press(key):
    print(key)

def on_release(key):
    print(key)

def on_click(x,y,button,pressed):
    print(button)

class Keylogger(Thread):
    def run(self):
        with keyboardListener(on_press=on_press,on_release=on_release) as listener:
            listener.join()


class MouseLogger(Thread):
    def run(self):
        with mouseListener(on_click=on_click) as listener:
            listener.join()

我尝试过使用非常便宜的鼠标和 Corsair 25 美元的鼠标。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)