I would like to display a different text object each time the subject presses a key depending on which key has just been pressed and I would like only a specific key to advance to the next trial.
For example the screen should display text that says "5" and then if the subject presses the down key it changes to "4" and if they press the up key it changes to "6" etc, but if they press enter we go to the next slide.
How to go about this?
What I have tried so far
I have been using the builder view to create a general framework then have been messing around with the code itself separately afterwards. I tried inserting a loop like this :
inloop=True
while inloop:
print "in the loop"
if event.getKeys('return'):
inloop = False
continueRoutine=False
elif event.getKeys('left'):
print "left key pressed"
elif event.getKeys('right'):
print "right key pressed"
elif event.getKeys('escape'):
core.quit()
If I put this inside the ContinueRoutine loop of the routine where I want this behavior I am unable to get "in the loop" or any other print statements to print so it seems it is not entering the loop. I have tried putting it a few other places as well and am having similar difficulties. Where would you insert such a loop and does this seem like a good way to go about solving this problem?