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:

Thanks
Gal

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()
mousex-=xOffset
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
    else:
        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
    else:
        ypos = -gridSize/2
    if math.isnan(xpos) or math.isnan(ypos):
        pass
    if xpos != oldX or ypos != oldY:
        print('inequality')
        gridCursor.setPos([xpos+xOffset, ypos])
        print('gridCursor')
        oldX = xpos
        oldY = ypos
print('Frame ending')

with

[mousex,mousey] = mouse.getPos()
mousex-=xOffset
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',
            text=gridText[Magdx],
            font='Arial',
            pos=(xOffset+maxScore*1.3*gridSize*Xdx, maxScore*1.1*gridSize*Ydx),
            height=0.04, 
            wrapWidth=.3, 
            ori=0, 
            color=textColour))
            Magdx+=1

then you’ll only get the outer box.

1 Like