psychopy.org | Reference | Downloads | Github

Associate slider and text

Hello, ,

I am looking to pair my slider and text. On one routine, I have three scales and three texts that I would like to present in pairs (one scale and one text, always the same pair) in a random way. By exemple : first text is “How much do you believe that it’s familiar” and the scale associated is 0 to 100 (Not familiar to familiar).

To do this, I would like to

  • either add text directly to my scale, or
  • or by adding a text component to the routine and associating it with the scale in question.

Here it is my code at python for the first slider:
Aim_S_VAS11 = visual.Slider(win=win, name=‘Aim_S_VAS11’,
startValue=None, size=(1.0, 0.02), pos=(0, -0.4), units=None,
labels=[“0” “Not familiar”, “100” " “Familiar” ],
ticks=[0, 100], granularity=0.0,
style=‘rating’, styleTweaks=(‘triangleMarker’,), opacity=None,
color=‘LightGray’, fillColor=‘Red’, borderColor=‘White’, colorSpace=‘rgb’,
font=‘Open Sans’, labelHeight=0.03,
flip=False, depth=-5, readOnly=False)
key_resp = keyboard.Keyboard()

How can I do it ?

Last question when the first one is solved, how to put the presented pairs randomly?

Thanks,
Best regards,
Caroline

Hi Caroline,

My experience regarding sliders is mostly about putting them online. To that end I have an alternative slider code (called interactive slider) which you can see on my Online Demos page.

Best wishes,

Wakefield

Hi Caroline,

I’ve only had experience with the Psychopy builder and online experiment but not coder. What I can think of is you can set three variables for three locations of slider text, and have a if logic to judge where each slider text should be according to the slider location (suppose you can get the slider position with a single line of code) in that routine. Hope this helps.

Hi Caroline, just to follow on from the above responses I do agree this would be much simpler to implement in builder - is there a particular reason that you must use coder?

Thanks!
Becca