I have this program in pycharm python3.8 that i need to detect if ctrl+c is pressed anywhere while browsing windows while the program is running, but for some reason the program does not detect if the pressed key is the "ctrl" my code looks like this:
from pynput import keyboard
def on_press(key):
if any([key in COMBO for COMBO in COMBINATIONS]):
current.add(key)
if any(all(k in current for k in COMBO) for COMBO in COMBINATIONS):
print("Ctrl+C pressed")
def on_release(key):
if any([key in COMBO for COMBO in COMBINATIONS]):
current.remove(key)
COMBINATIONS = [
{keyboard.Key.ctrl, keyboard.KeyCode(char='c')}
]
current = set()
with keyboard.Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
It never gets to print the message. I am running the program on Windows 10 Pycharm internal command line
Thanks!