psychopy.org | Reference | Downloads | Github

Object isn't getting dropped off a list

I am running an experiment where objects are being displayed on different locations on the screen and participants get to practice by placing the objects in that location with feedback of “Correct/Incorrect”. If the participant gets it right twice, the image is to be considered learned and the code shouldn’t display that image. But, for me, it keeps showing all the images irrespective of how many times I get them correct.

feedbackimage.setPos((locationX,locationY))
chosenimage.setPos((clickX,clickY))
trials.addData("clickX",clickX)
trials.addData("clickY",clickY)
distance=sqrt(pow((locationX*SCREENWIDTH)-(clickX*SCREENWIDTH),2)+pow((locationY*SCREENHEIGHT)-(clickY*SCREENHEIGHT),2))

#thisObject= randchoice(objectList)
thisObject =np.random.choice(objectList)

if (distance <= CORRECT_THRESH):
  if thisObject not in learned and firstRun:
    learned.append(thisObject)
  feedbacktext.setText("CORRECT")
else:
     feedbacktext.setText("INCORRECT")
objectnum= learned.count(thisObject)
if objectnum == 2:
    trials.finished = True
else:
    trials.finished = False

I have been trying to figure out for a while, I greatly appreciate any help. Thanks!

Hi @Gayathri_Subramanian , I cannot tell from your code, but it could be that you need to set the autodraw property of your learned images to false, so they are no longer drawn on screen. So, something like:

if thisObject not in learned and firstRun:
    thisObject.SetAutoDraw(False)
    learned.append(thisObject)

Sorry for the late reply. That works, thank you so much!