Hi Marco,
You haven't quite got the order of events right here: the stimulus won't appear until win.flip() has completed, so the .waitKeys() call has to come after that.
There are a number of timing demos under the "Demos" menu in the Coder view. But something like this could work for you:
win = visual.Window([1300,650], color= 'black', units = 'pix')
stim = visual.TextStim(win, text='stimulus', height=18, color='white',pos=[0,-0] )
timer = core.Clock() # just need to create this once
stim.draw() # send the stimulus to the back buffer
win.flip() # actually display the stimulus
timer.reset() # zero the clock from the moment the stimulus has been displayed
number_resp_key = event.waitKeys(keyList=['1', '2', '3',])
rt = timer.getTime() # the time elapsed
Note that you can also send a clock to the waitKeys function so that the keypresses are returned automatically with a time stamp attached:
timer.reset() # zero the clock (if desired).
number_resp_key = event.waitKeys(keyList=['1', '2', '3',], timeStamped=timer) # now returns keys & times
But note that by using waitKeys, you are no longer synchronising with the screen refresh cycle. That may or may not be important to you. i.e. an alternative is to have a loop which calls win.flip() on every iteration followed by a call to event.getKeys(). Rather than waiting for a response, this just checks the instantaneously for any keypresses since the last time it was called.
Regards,
Michael
--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND
Senior Research Fellow,
michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph:
+64 3 3786 072
University of Otago, Christchurch
http://www.nzbri.org/macaskill