Description of the problem: Our MRI experiment requires the use of the blue and yellow buttons of the cedrus button box (LS-PAIR) to have a slider component move up and down. This is done in order to continuously rate pain over the experiment.
We are not able to have the buttons move the slider, and want to see if anyone has a solution.
Currently this is the code we are using for this (but it doesn’t work):
# check for key presses
buttonBox.poll_for_response()
while len(buttonBox.response_queue):
evt = buttonBox.get_next_response()
if evt['key'] not in [0, 1]:
continue # we don't care about this key
if evt['pressed']:
theseKeys.append(evt['key'])
theseRTs.append(buttonBox.clock.getTime())
#TODO# Update VAS display:
# if button 0, move left on slider
# if button 1, move right on slider
# https://discourse.psychopy.org/t/press-and-hold-key-to-move-slider/8014
# https://discourse.psychopy.org/t/sliders-moved-by-keyboard-and-response-recording/18673
if evt['key'] == 0:
slider_2.markerPos -= 1
elif evt['key'] == 1:
slider_2.markerPos += 1
We also used a version with rating
rather than markerPos
, which also didn’t work.
We’d love you big time if anyone had some tips!