Advertisement
Guest User

Untitled

a guest
Apr 18th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1.  
  2. # Alternately show canvases and record keypresses,
  3. # until a key has been pressed.
  4. self.set('flag',0)
  5. for i in range(N):
  6.     t1 = self.time()
  7.     canvas_list[i].show()
  8.     key, t2 = my_keyboard.get_key()
  9.  
  10. # wait for
  11. # the first keypress post the position in the loop that is marked by the variable 'critops'...
  12.     if key is not None and i > self.get('critpos') and self.get('flag' ) == 0
  13.         if key == self.get("correct_response"): # if it's the correct key ...
  14.             correct_sound.play()
  15.             self.sleep(SOA-(t2-t1))     # wait for the next canvas for SOA minus RT        
  16.             self.set('flag',1)      # a button has been pressed, stop checking
  17.         else:                   # otherwise ...
  18.             incorrect_sound.play()
  19.             self.sleep(SOA-(t2-t1))     # wait for the next canvas for SOA minus RT
  20.             self.set('flag',1)      # a button has been pressed, stop checking
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement