I am running an experiment that requires participants to zoom in and out of images (circular) using a keyboard response (either left or right). I am trying to put a min and max threshold on their responses (in relation to the image size) so they can only zoom in or out of the image to a certain image size e.g. 1600,1600 pixels. However, I would like them to be able to zoom in the other direction if they meet the max or min threshold either end (I hope this makes sense).
I have declared min and max image size in the ‘Begin Routine’ section of a code snippet and have attempted to call these in, however they don’t seem to limit the size of the image. I have tried other variations where I say if maxSize is reached then stop keyboard input but this ends the routine, and I want the participant to be able to scale up and down until they are happy with the image size then finish the routine (trial) themselves.
maxSize = (1600,1600)
minSize = (1200,1200)
Below is the code to zoom in and out (in pixels). I have tried to declare the max and min sizes after the key inputs.
if response_image.status == STARTED: key = event.getKeys() if len(key) > 0: if key == 'left': response_image.size += (-100,-100) response_image.size == maxSize elif key == 'right': response_image.size += (100,100) response_image.size == minSize elif key == 'space': thisExp.addData('chosen_size', response_image.size) thisExp.addData('RT', t) continueRoutine = False elif key == 'q': win.close() core.quit() keys = event.getKeys(keyList = ['q']) if 'q' in keys: win.close() core.quit() event.clearEvents(eventType = 'keyboard')
Thank you for your help.