Howdy, Stranger!

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

Supported by

Stimuli Presentation Coordinates.

Hi Folks,

I'm presenting varying lengths of strings/text via a list in a SketchPad in OpenSesame.

I was wondering: is there anyway to record the x-y coordinates in the output file?

When using unique SketchPads for text typed into them I can hover the mouse over each letter/area and see the x-y coordinates but obviously I can't do this when using a list to pull the stimuli from.

This will be especially important when considering 'areas of interest' when I eventually set up an eye-tracking experiment in a few weeks.

Any insight would be appreciated.




  • Hi Boo,

    You can. As of OpenSesame 3.2, each Canvas element has a rect property that will give you the bounding box around the element. Like so:

    c = Canvas()
    c['my_text'] = Text('Hi!')
    x, y, w, h = c['my_text'].rect
    print(x, y, w, h)

    If you want to get the coordinates of an element on a sketchpad, you can do this in a similar way, provided that you have given the element a name. So say that there's an element called my_text on a sketchpad called welcome, then you could get the bounding box like so:

    x, y, w, h = items['welcome'].canvas['my_text'].rect
    print(x, y, w, h)

    Then if you want to log this information, you simply have to assign the coordinates to an experimental variable, i.e. a property of the var object:

    var.my_text_rect = 'x:{}, y:{}, w:{}, h:{}'.format(x, y, w, h)


    Thanked by 1booradley

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

  • Hi Sebastiaan,

    That's awesome. Thanks!


Sign In or Register to comment.