Mart R
Mart R

Reputation: 126

pyautogui keyboard.add_hotkey works only to map hotkeys with single keys

I use Parallels on a MacBook and when I use:

keyboard.add_hotkey('f2', lambda: click_text_field())

it is all fine. But when I combine keys, such as

keyboard.add_hotkey('alt+f2', lambda: click_text_field())

it won't work.

Any ideas why not? Any suggestions of workarounds?

many thanks!

Upvotes: 1

Views: 536

Answers (2)

David Robinson
David Robinson

Reputation: 36

Try this:

keyboard.add_hotkey('alt, f2', lambda: click_text_field())

Upvotes: 1

Mart R
Mart R

Reputation: 126

On Mojave, there's a new security feature where you must explicitly allow applications to use your mouse/keyboard. Have a look in Security Preferences > Security & Privacy > Privacy > Accessibility - you might have to allow Parallels.

Upvotes: 1

Related Questions