import ctypes
import sys
def change_mouse_buttons(swap):
user32 = ctypes.windll.user32
user32.SwapMouseButton.argtypes = [ctypes.c_int]
user32.SwapMouseButton.restype = ctypes.c_int
result = user32.SwapMouseButton(swap)
if result == -1:
print("鼠标按钮切换失败。")
sys.exit(1)
elif swap:
print("鼠标按钮已切换。")
else:
print("鼠标按钮已恢复。")
if __name__ == "__main__":
user32 = ctypes.windll.user32
current_swap = user32.GetSystemMetrics(23)
change_mouse_buttons(not current_swap)
这段代码,我保存到.py文件,直接运行是可以的。但是用quicker的“运行python代码”模块就没反应,是咋回事呢?