I am designing the Operation Span task in PsychoPy
. In this task, the participant sees a couple of letters, and then they need to recall the letters in the correct order.
In my case, the recall phase is designed as a routine including separate text components for each letter presented at different positions on the screen. Next to each letter, there is an empty textbox component with a vivid frame. The participant is instructed to click in these textboxes in the same order as they saw the letters. The routine also includes a mouse component in which all the textboxes are defined as clickable stimuli. "End routine on press" is set to 'never'.Finally, the routine includes the copied code component below. The code comprises a list of clickables, each corresponding to the textboxes next to individual letters (named accordingly). The code is intended to assign a number to each textbox, sequentially, upon clicking. For instance, if the participant clicks on 'H' first, '1' should appear. Subsequently, if the participant clicks on 'F', '2' should appear, and so on.
The problem is that the displayed numbers do not increase by 1. Instead, they increase by 2 or 3, and I cannot detect any algorithm in such increments. Do you have any idea why the code does not work? I would appreciate any suggestions for correcting the existing code or for a different approach.
# begin routine tab clicked_letters= [] # each frame tab clickables = [F, H, J, K, L, N, P, G, R, S, T, Y] # List of numbers from 1 to 16 numbers = list(range(1, 17)) # Counter to keep track of the current position in numbers list counter = 0 # check if the mouse is pressed in any of the letters for clickable in clickables: if mouse_Practice_Letters.isPressedIn(clickable): clicked_letters.append(clickable) # change the box to number if clicked for clickable in clicked_letters: clickable.text = str(numbers[counter]) counter += 1 if mouse_Practice_Letters.isPressedIn(Skip): continueRoutine = False