Shrink/enlarge image based on given response
Hi all,
I'm programming an approach-avoid task using inline scripts in opensesame.
Participants have to sort portrait and landscape images by moving the mouse to the top or bottom of the screen.
For mousetracking I'm using mousetrap. I programmed it so that two invisible boxes are on the top and bottom of the screen. And in the middle of the screen the stimulus image is presented.
When someone moves the cursor to the top box (avoid) I want to shrink the picture, and when someone moves the cursor to the bottom box (approach) I want to enlarge the picture.
I can't seem to figure out a way to do this.
As of now the inline script (run phase), after the mousetrap item, looks like this:
response_canvas = canvas()
if var.response_mousetrap_response == "top_box":
response_canvas.text("Image is supposed to get smaller now")
elif var.response_mousetrap_response == "bottom_box":
response_canvas.text("Image is supposed to get larger now")
response_canvas.show()
Does anyone know of a way to do this?
Comments
Hi Femke,
Are you using a
sketchpadto present the display? If so, then I would download the latest prerelease of OpenSesame 3.2, because it allows you to name and access the elements on asketchpad. So, say that your image is called, 'my_image' and yoursketchpadis called my_sketchpad, then you could increase the size of the image as follows:See also:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
No, I'm using mostly canvas' via inline scripts. But I'll check out your suggestion though. Thanks!
Hi Sebastian,
I have same question. And i tried the code(above), but didn't understand what to write instad of 'my_image'. Should i put my image list name in the block loop? When i put my image list name, i have an error 'KeyError 'image1.png''
I'd appreciate it if you answered.
Thanks.
I found the answer to my question in another topic on the forum (Eduard's answer).
Thanks OS.