pynput
pynput copied to clipboard
Unable to control keyboard on Mac
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.