Projet

Général

Profil

Raspberry Pi - Jauge Incluedo » test.py

Thomas-Alexandre Moreau, 21/02/2025 10:19

 
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
(2-2/2)