My pause button is being counted as a response for an item, not just pausing screen

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version: v2021.2.3
Standard Standalone? Y)
What are you trying to achieve?:

I am trying to create a pause button that presented a pause screen during a routine whenever the experimenter presses a button.

image

What did you try to make it work?:

I have created a pause routine in a loop. The code is over simplified and I know why it is not working as intended.

Within the experiment, which is all nested within the PNT_1 routine we have three components.

image

An image is shown, the participant names the image, the examiner documents a correct or incorrect response with a 1 or a 2 key press. The available key presses include 1, 2, or p. Where p is called in the pause2 routine to pause the routine.

The pause routine looks as follows:
image

When p is pressed in the PNT_1 routine we go to a pause screen. Then, the examiner hits p to resume the experiment.

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

Here is the problem:
When the examiner hits the ‘p’ response the screen goes to the “pause screen;” however, it also documents ‘p’ as the response to the item being shown.

I believe this is because of the over simplification of the pause routine, which is coded simply as:

if PNT_Acc1.keys != "p":
    continueRoutine = False

I looked at some other code for a pause button as documented here:

and implented the code from that page as follows:

 # check whether to pause
if PNT_Acc1.keys != "p":
    paused = True # stop right here
    image_PNT.append(image) # store the current image number 
    # or could append(image.image) to store the actual image name.

    while paused:
        if pause_screen('p'):
           paused = False
        else:
            # need to let the rest of system time to do stuff in this tight loop 
            time.sleep(0.001) # 1 ms per iteration should do

The error I get is as follows:

'ImageStim' object has no attribute 'append'

And I am not sure where to go from here.

Thanks in advance for anyhelp.

You can’t append to a component name (image_PNT). What are you trying to do here? Change the image?

I am trying to make it so when i press the button p during my trials that the screen does not present a new stimulus, instead goes to a screen that states the experiment is paused. When the experimenter then presses p on the pause screen I would like it to go back to the same image that was being presented during the trial in which the examiner hit the pause button on. That way, the examiner can score the response after the pause and then resume further trials.

The initial code i provided rather than, “what i tried to make it work” almost achieves this.

When p is hit, the experiment goes to the pause screen. When it is hit again, the pause screen ends and goes back to the experiment. However, when it returns to the experiment the next stimulus is shown instead of the stimulus in which the pause button was hit on.

THe output of the model in this case shows a p as the response for this item, where I would like to be able to score that item as a 1 or a 2 for correct/incorrect.

Does that make sense?