Adjusting size of picture with key presses

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

OS Win10
PsychoPy version 2022.2.4
What are you trying to achieve?:
I would like to create an experiment where participants see a picture on the screen and can change the size of the picture by pushing the up and down buttons (e.g. increasing the size with up, decreasing it with down).
In a previous version of the experiment I have managed to make it work with the scroll of the mouse (scrolling up to make to make it bigger down to make it smaller) and saving the final size. Now I need to do something similar but with the keybaord.

Also, I will need to put it online as well afterards, so I need a code which works in both psychoPy and psychoJS, so e.g. I can’t import packages.

What did you try to make it work?:
I tried the below code, and it gets to the point where I see the start size of the picture, but then when I press one of the buttons it just starts zooming or dezooming by itself and didn’t stop. Ideally I would want it to multiply the size ONCE by 0.85 or 1.35 when sby presses the button and once more, if they press again etc.

Could somebody help me how to achieve this?

image

Also, right now these elements are in my routine:

Thank you a lot!

Best,
Laura

Hello Anna Laura

you might want to take a look at the screen-scale procedure (Pavlovia) by @wakecarter.

Best wishes Jens