Projet

Général

Profil

Cinquième semaine » test.py

Thomas-Alexandre Moreau, 13/02/2025 16:46

 
import keyboard

# Define the callback function to track key presses
def on_key_event(e):
print(f"Key {e.name} {e.event_type}")

# Start listening for key events
keyboard.hook(on_key_event)

# Wait indefinitely so the listener stays active
keyboard.wait('esc') # The program will stop when the 'esc' key is pressed
(6-6/6)