I’m building this experiment in which the participants can build an unlimited number of barriers in a 20x10 grid. Based on the participants inputs, the barriers positions are included in a
Barrier_list in the
End Routine tab of a code component:
if ... #participants correct responses: barrier_pos = [datetime.datetime.now(), copy.deepcopy(Subject_position)] Barrier_list.append(barrier_pos)
Begin Routine the following code draw the barriers in the screen based on their positions:
for Barrier_position in list(Barrier_list): Barrier = visual.Rect( win=win, name='Barrier',units='pix', width=(49.5, 49.5), height=(49.5, 49.5), ori=0, pos=Barrier_position, lineWidth=0, lineColor='black', lineColorSpace='rgb', fillColor=u'black', fillColorSpace='rgb', opacity=1, depth=-5.0, interpolate=True) Barrier.setAutoDraw(True)
Ten seconds after being appended to the list, each barrier is removed from it using the timestamp that goes with the position in the code inserted in the
Each Frame tab:
for barr in list(Barrier_list): datetime.datetime.now() if barr <= (datetime.datetime.now() - datetime.timedelta(seconds=10)): Barrier_list.remove(barr) Barrier.setAutoDraw(False)
Barrier_list shows me that the Ask to print
Barrier_list shows me that the
[timestamp, [positions]] are being appropriately appended to the list and removed after 10 seconds and the Barriers images are also being drawn in the correct positions. However, when the element
[timestamp, [positions]] element is removed from
Barrier_list, their images persist on the screen.
Why would this be happening and what can I do to make their images disappear when I remove them form the list?
Thanks and best regards,