My problem is how pynput
returns the data (I hope that\'s how you would say it?).
So what I\'m trying to do is have the listener record keyboard input, the
You can extract the character from the pressed key by using the char
attribute of the pynput.keyboard._win32.KeyCode
. In other words, in your press
function, you would append key.char
to the list. Also, I would avoid using list
as a variable name.
def press(key):
print(_list, 'pressed')
if key is not keyboard.Key.space:
_list.append(key.char) # <-- Note: key.char
elif keyboard.Key.space is key:
pass
elif keyboard.Key.enter is key:
pass