Recording multiple different key presses during video and logging key press and key press time
Hey all,
For my experiment I'm playing a video that I want to continue playing until the end (3 minutes). DURING the video I want to record all left and right arrow key presses that occur and when. I want to log whether it was a left or right arrow and at what time the key was pressed (compared to the onset of the video). Right now I have a media_player_mpy that calls Custom Python code on every key press.
The code I have now is log.write(u'time = %s' % clock.time()), but that is the time since the experiment has been running and does not give which key was pressed.
Comments
Hi,
To get the timing info, you can implement the idea in this discussion:
http://forum.cogsci.nl/index.php?p=/discussion/4602/recording-multiple-mouse-clicks-during-video#latest
To get the keypresses, you can use pygame functionality in your script. Import pygame and collect keypresses in a loop. (Or psychopy, doesn't really matter I think)
Does that make sense?
Eduard
HI Eduard,
I have a similar issue, can you please explain how to use the pygame functionality?