Hi all,
I wanted to make a slider and an image corresponding the slider rating value like what I wrote before: Sliders with images. But translating it to online experiment, I had a problem with it, since, as crib sheet (PsychoPy Python to Javascript crib sheet - Online experiments - PsychoPy) indicated, ‘set every frame’ is broken in online experiment. As before, I would like to move my slider using keyboard and get image having corresponding values so that I wrote this:
arrowKeys = event.getKeys(keyList=['left', 'right'])
if 'left' in arrowKeys:
cur = slider_practice.getRating()
slider_practice.recordRating(cur-1)
sld_img.image = stim_id[int(slider_practice.getRating())]
if 'right' in arrowKeys:
cur = slider_practice.getRating()
slider_practice.recordRating(cur+1)
sld_img.image = stim_id[int(slider_practice.getRating())]
and also for my slider to begin with a value randomly chosen from a set of values,
Plus, my image component(sld_img) is:
The first problem is that the slider had no initial marker at the beginning of routine:
(when the experiment runs without image component)
The marker came out and I could make it move using keyboard only after I clicked the slider. I have tried to add:
slider_practice.markerPos = current_anchor
slider_practice.markerPos
and run the experiment with this and failed. How can I show the marker at start?
The second problem is that images did not change with slider values. It changed only after I clicked the slider and press left or right arrow. When I pressed the keys a few more times, the slider changed, but the image did not change.
When I edited my slider code like this:
arrowKeys = event.getKeys(keyList=['left', 'right'])
if 'left' in arrowKeys:
cur = slider_practice.getRating()
slider_practice.recordRating(cur-1)
if 'right' in arrowKeys:
cur = slider_practice.getRating()
slider_practice.recordRating(cur+1)
sld_img.image = stim_id[int(slider_practice.getRating())]
,the image disappeared like the screen above, without any image component. Is there any way to handle this problem?
Thank you