所以我从 pyautogui 库中获得了这段代码,但我并不完全理解它的实际作用。
for apply_mod, vk_mod in [(mods & 4, 0x12), (mods & 2, 0x11),
(mods & 1 or needsShift, 0x10)]: #HANKAKU not suported! mods & 8
if apply_mod:
ctypes.windll.user32.keybd_event(vk_mod, 0, 0, 0) #
ctypes.windll.user32.keybd_event(vkCode, 0, 2, 0)
for apply_mod, vk_mod in [(mods & 1 or needsShift, 0x10), (mods & 2, 0x11),
(mods & 4, 0x12)]: #HANKAKU not suported! mods & 8
print()
if apply_mod:
ctypes.windll.user32.keybd_event(vk_mod, 0, 2, 0)
假设我有一个不会改变或抛出错误的预期输入,我可以取出/重写什么以使其更快(目前相当慢)