Scale rating in 2D space

I’m trying to find the best way to implement the rating scale in the attached image.
The participant needs to click anywhere in the white space, and I need to know the location of the click relative to the space (on both axis)

any suggestions will be greatly appreciated :slight_smile:


Have a look at my Affect Grid demo which does something similar offline and online

thanks! where can i find it?

Search Pavlovia or this forum for affect grid (I’m on my phone)

It’s probably Vespr/affect-grid

I found it. thanks!!

do you maybe have another idea, if I input the scale as an image, and then save the location of the mouse click?

I can see that your display is different but I wondered whether you might find the code I use to move and save the mouse position useful.

I need precise coordinates, so the categorial scale is less good for me. what i mean - to be able to chose from the whole space and not just in the boxes

Try changing code_grid to an auto component and replacing

[mousex,mousey] = mouse.getPos()
if abs(mousex) < maxScore*gridSize and abs(mousey) < maxScore*gridSize:
    if mousex > gridSize/2:
        xpos = round(mousex/gridSize-.5)*gridSize+gridSize/2
    elif mousex < -gridSize/2:
        xpos = round(mousex/gridSize+.5)*gridSize-gridSize/2
    elif mousex > 0:
        xpos = gridSize/2
        xpos = -gridSize/2
    if mousey > gridSize/2:
        ypos = round(mousey/gridSize-.5)*gridSize+gridSize/2
    elif mousey < -gridSize/2:
        ypos = round(mousey/gridSize+.5)*gridSize-gridSize/2
    elif mousey > 0:
        ypos = gridSize/2
        ypos = -gridSize/2
    if math.isnan(xpos) or math.isnan(ypos):
    if xpos != oldX or ypos != oldY:
        gridCursor.setPos([xpos+xOffset, ypos])
        oldX = xpos
        oldY = ypos
print('Frame ending')


[mousex,mousey] = mouse.getPos()
if abs(mousex) < maxScore*gridSize and abs(mousey) < maxScore*gridSize:
    xpos = mousex
    ypos = mousey
    if xpos != oldX or ypos != oldY:
        gridCursor.setPos([xpos+xOffset, ypos])
        oldX = xpos
        oldY = ypos

thank you! any chance that the grid will not show?

I think if you delete

for Ydx in [1,0,-1]:
    for Xdx in [-1,0,1]:
        if Xdx!=0 or Ydx !=0:
            grid.append(visual.TextStim(win=win, name='errortext',
            pos=(xOffset+maxScore*1.3*gridSize*Xdx, maxScore*1.1*gridSize*Ydx),

then you’ll only get the outer box.

1 Like

Hello! I am attempting to build an experiment that essentially combines your affect grid with a continuous scale to see what participants’ affect is every few frames of a video. How would you suggest I do that?

For continuous measurement you might need to

a) Remove round() from code_grid Each Frame lines 5 and 7.

b) Add code to save the ranting every few frames, e.g.

if frameN % 3 == 0:
     thisExp.nextEntry() # To move to next row in data file

You might also need to change the size and position if you want the video on the same screen.

Thank you for the help! When you say "remove round() " do you mean just the word round and the parentheses, or also the text within the parentheses? Sorry I’m super new to Python and PsychoPy. With adding your code and removing round() it is now allowing the grid cursor to move wherever, and once it breaks the bounds of the grid it kind of shoots itself to the outer edges of the screen. Do you know why this might be?