I am unable to get the right time of reaction.
Following is my attempt on achieving it:
kb = keyboard.Keyboard()
RT = core.Clock()
def run(data):
trial=0
for j in range(1,5):
for i in data:
kb.clock.reset()
excelTrialEq = trial
print (i)
myword.text=i[0]
myword.draw()
mywin.flip() #draw letter
RT.reset()
RT.add((0.25) + i[1]
core.wait(0.25)
mywin.flip() #draw blank(ISI)
while RT.getTime() < 0 : pass # wait till end stimulus showing + ISI
i expect the output like
['M', 1]
1 2 M 1
space, 0.50980908090
...
but the actual output is
['M', 1]
1 2 M 1
['K', 1]
space -0.25774913992427173
...
It is not really clear from your code what you want to do. However, if I understand correctly you show something on the screen and wait for the user to press the spacebar. The most simple thing to do would be this:
import time
#When the item appears on the screen
startTime = time.time()
#When the user presses space
endTime = time.time()
reactionTime = endTime - startTime
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.