Mac下全选,使用pynput,怎样调用command键?

Key.command 不行,用Key.cmd  。

win或linux下:
 

with keyboard.pressed(Key.ctrl):

    keyboard.press('a')

    time.sleep(1)

    keyboard.release('a')

那么在mac下就是:

with keyboard.pressed(Key.cmd):

    keyboard.press('a')

    time.sleep(1)

    keyboard.release('a')

因为mac下全选按钮是command + A

你可能感兴趣的:(macos,python)