Remove() and .opacity isnt working on PsychoPy 2023?

Hi, I am newbie in coding, but this coding (that are similar from the others) aren’t working

> elif response.isPressedIn(targetbox3): 
>     for targetbox3 in clickables:
>         clickables.remove(targetbox3)
>         targetbox3.opacity = 1

While the others above are working

Here is the experiment.
Please, Take a look.
SMTS.psyexp (139.3 KB)

That code looks wrong.

elif response.isPressedIn(targetbox3):  # There is a component called targetbox3
     for targetbox3 in clickables: # Now targetbox3 is being used as a dummy variable.
         clickables.remove(targetbox3) # Now you are trying to delete all clickables
         targetbox3.opacity = 1

Try

elif response.isPressedIn(targetbox3):  
         clickables.remove(targetbox3)
         targetbox3.opacity = 1

Why do you need to iterate through all clickbles to delete one object?