Logging multiple key presses and duration between key presses
I am new to Python and am trying to set up an experiment in which the subject looks at an ambiguous image for a minute, and presses the left or the right key to indicate what they are seeing. I would like to collect the key presses and the timings of the key presses in a log file. I have tried to do this using pygame.event.get () and specifying the time of KEYDOWN for each press as time - t0, but am not sure how to specify both the name of the key (K_RIGHT; K_LEFT) and also the state (KEYDOWN). I would be very grateful for any help!