hi all, i would like to take keyboard number presses and display them on the screen. participants can press any number between 1-100, then press enter to move to the next trial. i can only get it to display the previous number (theseKeys[-1]) or all the numbers (theseKeys) in the form [‘8’ ‘5’ ‘return’]. I would like to simply display the number itself (85, without ‘enter’) and i would also like to store this number for use in the next trial.
some example of my script is below.
theseKeys3 = event.getKeys(keyList=['1','2','3','4','5','6','7','8','9','0', 'return']) if len(theseKeys3) >0: # at least one key was pressed key_resp_3.keys.extend(theseKeys3) # storing all keys #if len(theseKeys3) ==1: choicetext.setText(theseKeys3[-1]) if "return" in theseKeys3: continueRoutine=False
I tried using things like:
if len(theseKeys3) ==2:
etc but this doesn’t work