psychopy.org | Reference | Downloads | Github

How to change the font size of Slider label


#1

Hi everyone,

A problem when I use Slider is the Slider label’s font size was too large, but I did not find the way to change the font size or height in Builder. Can anybody give me a hint how to achieve this.

Thanks very much!


#2

Hi @YuanboBQ, this is actually a parameter of Slider, but is not customizable from Builder. Instead, just paste the Slider component into a code component, and add the parameter labelHeight with a value. E.g.,

slider = visual.Slider(win=win, name='slider',
    size=(1.0, 0.1), pos=(0, -0.4),
    labels=['low', 'high'], ticks=(1, 2, 3, 4, 5),
    granularity=0, style=('rating',),
    color='LightGray', font='HelveticaBold',
    flip=False, labelHeight = .5)


#3

Hi @dvbridges, the code works properly, thanks!

Sorry to ask another question about Slider here: is it possible to get the Slider value each frame like rating scale to present a text.

See the below link about this question:


#4

No problem. Yes, getRating gives you the final rating i.e., after mouse have moved the scale. You could instead use the slider.markerPos param, this updates every frame. Just make sure it corresponds to your ratings and you will be fine.