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.
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.
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:
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.