nimaid / LPHK

A Novation Launchpad Macro Scripting System.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Characters which require escaping in Python scripts cannot be used for TAP or PRESS.

oledirtyinode opened this issue · comments

I'm unable to use , /, or ' as valid targets for a TAP or PRESS command. I believe this is because these characters are considered "special" and require escaping in order to use them as plain characters.

Upon checking in pynput using a short script you can see what pynput sees when you type a backslash:

from pynput import keyboard

def on_press(key):
... try:
... print('alphanumeric key {0} pressed'.format(
... key.char))
... except AttributeError:
... print('special key {0} pressed'.format(
... key))
...
def on_release(key):
... print('{0} released'.format(
... key))
... if key == keyboard.Key.esc:
... # Stop listener
... return False
...

Collect events until released

... with keyboard.Listener(
... on_press=on_press,
... on_release=on_release) as listener:
... listener.join()
...
Key.enter released
alphanumeric key \ pressed
'\' released
alphanumeric key \ pressed
'\' released

Note the escaped version of the backslash: '\'.

What OS are you using?

Closing due to inactivity