Jul 31, 2017 10:40 AM
(This post was last modified: Jul 31, 2017 04:40 PM by TheWarOwl.)
EDIT: The solution is to use key.name
So assuming I use the example code:
When you press CTRL + C and release it, the release function outputs:
'\x03' Which I believe is ascii for ctrl^c, which I could handle with a simple dictionary I believe.
The issue is the keypress function gets this character:
Which I can do nothing with...
Anyone got any ideas on what I can do?
EDIT: The documentation shows "Controller.modifiers" but not much on how it's used.
I really hope this isn't a stupid question, I'm completely lost.
So assuming I use the example code:
PHP Code
<?php
from pynput.keyboard import Key, Listener
def on_press(key):
print('{0} pressed'.format(
key))
def on_release(key):
print('{0} release'.format(
key))
if key == Key.esc:
# Stop listener
return False
# Collect events until released
with Listener(
on_press=on_press,
on_release=on_release) as listener:
listener.join()
When you press CTRL + C and release it, the release function outputs:
'\x03' Which I believe is ascii for ctrl^c, which I could handle with a simple dictionary I believe.
The issue is the keypress function gets this character:
Which I can do nothing with...
Anyone got any ideas on what I can do?
EDIT: The documentation shows "Controller.modifiers" but not much on how it's used.
I really hope this isn't a stupid question, I'm completely lost.
![[Image: 5BgQiIm.gif]](https://i.imgur.com/5BgQiIm.gif)

