psychopy.org | Reference | Downloads | Github

Slider marker does not show in online experiment with keyboard control

Hello,

Could someone help me with the silder marker problem I have encountered recently with online experiment. I have searched in google for a while, but failed to find the answer. I appologize that if someone already solved this problem somewhere. If someone could point to a solution for me, that is much appreciated.

Description of the problem:
I created a slider that can be controlled by the keyboard. I initiated the slider marker with 2, if no prior rating was detected. This method worked well locally. But I need to first use mouse to click somewhere in the slider to make the marker show up, then the keyboard can move the silder maker. Below is my code:

### In the Each Frame tab
if slider.markerPos is None:
    # sets to our first position (or a random number?)
    # and makes marker visible
    slider.markerPos = 2

#check keys (just the ones we want)
keysPressed = event.getKeys(['left', 'right'])
for key in keysPressed:
    if key == 'left':
        slider.markerPos -= 1  # subtract 1
        slider.rating= slider.markerPos
    elif key == 'right':
        slider.markerPos += 1  # add 1
#    elif key == 'return':
#        # confirm rating by setting to current markerPos
        slider.rating= slider.markerPos

Have you looked at my interactive slider demo?

Hello Waktecarter.

Thank you very much for pointing to your extremely useful Online Demos. Your interactive slider perfectly fit my needs.