Problem with pygame.key.get_pressed() (orientation perception task)

Whoops, sorry! That’s my bad. I copied this from a more complex piece of code that has object structure, the ‘self’ thing I forgot to delete. Drop the ‘self’ altogether from wherever it shows up. Here’s fixed code:

key = pyglet.window.key  
keyboard = key.KeyStateHandler()
win.winHandle.push_handlers(keyboard)

if keyboard[key.LEFT]:
    BO -= 1
    thisExp.addData('adj_final_ori',BO)

if keyboard[key.RIGHT]:
    BO += 1 
    thisExp.addData('adj_final_ori',BO)

EDIT: Also you should put the first part in “begin routine” or “begin experiment”, and only the if statements on each frame.