OS (Win10): PsychoPy version (v2021.1.4): What are you trying to achieve?:
Trying to build a slider whose marker moves with arrow keys and people can select their answer with the RETURN key.
if slider_kbControl.markerPos is None:
# sets to our first position (or a random number?)
# and makes marker visible
slider_kbControl.markerPos = 3
#check keys (just the ones we want)
keysPressed = defaultKeyboard.getKeys(['left', 'right', 'return'])
for key in keysPressed:
if key == 'left':
slider_kbControl.markerPos -= 0.5 # subtract 0.5
elif key == 'right':
slider_kbControl.markerPos += 0.5 # add 0.5
elif key == 'return':
# confirm rating by setting to current markerPos
slider_kbControl.rating= slider_kbControl.markerPos
What specifically went wrong when you tried that?:
The slider does not work ONLINE. No marker is shown and the keyboard method for responding is not working. The response is recorded (and the routine ends) only when a mouse click happens.
Hi @wakecarter, thanks for the quick reply. I’ve had a look at your demo, but unfortunately, I get some errors concerning “slider_granularity” being not defined (I’ve basically copy-pasted your codes in my experiment.
Also, did I get it right that I just need one of the two routines in your demo (trial or iSlide)?
Sorry, I’m new to PsychoPy, and I’m really trying everything I can to make it work.
Yes, I’ve also included the contents of the start routine, that is why I don’t know what is going on. But if that is the only solution, I will try again. I might be doing something in the wrong way.
I also just discovered that the online experiments only work with the UK keyboard (not the Italian one, as left and right keys correspond to up and down). Probably that’s why I wasn’t able to make it work with all the material I previously found on this forum.