dpressed = 0 def on_press(key): if key == (\'d\'): global dpressed dpressed+=1 logging.info(\"D: %s\" % dpressed)
Whe
You need to format the key to char format else it won't be equeal to the specific character.
Try
if key.char == ('d'):
Full code being:
dpressed = 0 def on_press(key): if key.char == ('d'): global dpressed dpressed+=1 logging.info("D: %s" % dpressed)