pynput icon indicating copy to clipboard operation
pynput copied to clipboard

Unable to control keyboard on Mac

Open TsingJyujing opened this issue 4 years ago • 0 comments

I'm trying to use this piece of code to press ctrl+up to active mission control but failed:

from pynput.keyboard import Key, Controller, KeyCode
import time
if __name__ == '__main__':
    kb = Controller()
    with kb.pressed(Key.ctrl):
        kb.press(Key.up)
        time.sleep(0.1)
        kb.release(Key.up)

it only display ^[[1;5A in console, what should I do to apply a system wide key event?

Thank you very much.

TsingJyujing avatar May 18 '20 14:05 TsingJyujing