psychopy.org | Reference | Downloads | Github

Scale text display incorrect for visual.ratingStim

The text accompanying the rating stim object is positioned off center.

See this screenshot:https://ibb.co/xfVkD8N

The numbers should appear under the slider. Here is the code:

def get_slider_response(win):
    mintext = 0
    maxtext = 10000
    textrange = range(mintext, maxtext+1, 50)
    labelpoints = [0, 0.25, 0.5, 0.75, 1.0]  # the fractions of the range you want to have labels at
    labels = [str(int(maxtext * point)) for point in labelpoints]  # the actual text for each label
    ticks = [len(textrange) * point for point in labelpoints]  # t
    ratingScale = psychopy.visual.RatingScale(win["window"], choices=textrange, labels=labels, tickMarks=ticks, marker="slider", showValue=True, showAccept=True, lineColor="Black")
    while ratingScale.noResponse:
        ratingScale.draw()
        win["window"].flip()
    rating = ratingScale.getRating()
    win["window"].flip()
    return

I think the problem is due to the use of norm units internally in ratingScale.py

I’m not that familiar with the RatingScale, but the general advice these days is to use the newer Slider class. It is more minimalist in terms of features but also less complex.

https://www.psychopy.org/api/visual/slider.html

Thanks for the reply. I actually couldn’t get Slider to work at all (can post error message if required, but I’m more interesting RatingScale).

Part of the problem is solved by the following (in ratingscale.py near line 755):

#self.tickPositions.append(horizTmp)
self.tickPositions.append(horizTmp+1)

Which suggests that the horizTmp position is miscalculated.