1

I am looking for idea how to measure time between next pressed keys in python. I know that I can use input/raw_input, but it is connected with pressed "enter - I want to catch any pressed key.

e.g. pressed A, next pressed B, time between A and B is 0.500 s

I would be grateful for your help. Thanks

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Luy Corp.
  • 41
  • 2
  • See here: https://stackoverflow.com/questions/13207678/whats-the-simplest-way-of-detecting-keyboard-input-in-python-from-the-terminal – mattsap Feb 26 '19 at 19:04
  • 1
    Question Op was asking is for time lapse between key strokes. not for detecting the key, – Pavan Chandaka Feb 26 '19 at 19:06
  • I want to measure time between pressing, detecting the key is part of that what I want to reach. – Luy Corp. Feb 26 '19 at 19:13
  • Keystroke detection itself needs a third-party package and are platform-dependent; there are several options listed in the questions linked by others in these comments. Once you've chosen how to do that, simply catch the moment of a keystroke using `datetime.datetime.now()`, then subtract the latest one from the previous one. You'll get a timedelta object which has various methods to give you the value you need, such as `my_td_object.total_seconds()`. – theberzi Feb 26 '19 at 19:50

0 Answers0