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()

if keyboard[key.LEFT]:
    BO -= 1

if keyboard[key.RIGHT]:
    BO += 1 

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