我需要使用键盘包以编程方式同时按下控制键和右箭头键。
我试过
keyboard.press("ctrl+right")
keyboard.press("ctrl+\033[C")
但两者都会导致ValueError:
Traceback (most recent call last):
File "C:\Users\User\anaconda3\lib\site-packages\pyHook\HookManager.py", line 351, in KeyboardSwitch
return func(event)
File "test2.py", line 37, in onKeyboardEvent
keyboard.press("ctrl+\033[C")
File "C:\Users\User\anaconda3\lib\site-packages\pynput\keyboard\_base.py", line 362, in press
resolved = self._resolve(key)
File "C:\Users\User\anaconda3\lib\site-packages\pynput\keyboard\_base.py", line 556, in _resolve
raise ValueError(key)
ValueError: ctrl+[C
如何发送Ctrl-Right Arrow击键?
冉冉说
相关分类