OS : macOS Mojave, version 10.14.6
PsychoPy version : PsychoPy v2020.2.4
I am new on PsychoPy and I am trying to set an experiment about decision making.
In this experiment participants will see different image and will rate them according to how much they think each image is associated with a color (3 different colours).
I already set up a simple version of the task that display the image and where participants have to choose between two options (with their keyboard) and it seems to work fine.
This time I want to do something a little bit more complicated: I want to use 6 different sliders (3 for each images) with a keyboard. In addition, these sliders need to be mutually exclusive.
For the moment I found a way to create and move sliders with the keyboard in the forum (by @dvbridges).
I put the following code in “each frame” in the builder
slider = visual.Slider(win=win, name='radio', size=(1.0, 0.1), pos=(0, -0.1), labels=['a','b','c','d','e'], ticks=(1, 2, 3, 4, 5), granularity=0, style=['slider'], color='LightGray', font='HelveticaBold', flip=True) sliderHistorySecond =  slider.markerPos = 2 while True: keys = event.getKeys() if keys: if 'down' in keys: slider.markerPos -= 1 continueRoutine = True if 'up' in keys: slider.markerPos += 1 continueRoutine = True if 'space' in keys: slider.getRT() continuRoutine = False break if 'escape' in keys: core.quit() slider.draw() win.flip()
I change the code a little bit to enable to finish the trial by pressing “space”. As continueRoutine = false doesn’t work I add a break but I don’t think that it’s the good way to do it.
The first issue is that it doesn’t record the response of participants event if I add slider.getRating() in the script. The sliders move correctly and pressing “space” enable to finish the trial.
I tried to create an empty list and to append slider.getRating() in it and even if I have no error it doesn’t appear anywhere.
In addition, is it possible to have vertical coded slider like a “normal slider” that can be added in the builder directly? I didn’t find the option in visual.Slider parameters.
My ultimate goal is to have 2 pie charts (with 3 colors each and that follow the sliders ratings) that is update each time a participant moves the sliders (to show them their rating more visually) and the first step is then to have sliders that record something.