Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Shrink/enlarge image based on given response

edited November 2017 in OpenSesame

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 sketchpad to 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 a sketchpad. So, say that your image is called, 'my_image' and your sketchpad is called my_sketchpad, then you could increase the size of the image as follows:

    my_canvas = items['my_sketchpad'].canvas
    for scale in range(100, 200):
        my_canvas['my_image'].scale = .01*scale
        my_canvas.show()
    

    See also:

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • No, I'm using mostly canvas' via inline scripts. But I'll check out your suggestion though. Thanks!

Sign In or Register to comment.