PsychoPy version: 3.1.5
I have some old experiments that no longer work in PsychoPy3. I’m trying to update them for PsychoPy3 standalone and online. The problem (besides being my lack of experience with more complicated code) right now is text entry. This code worked prior to PsychoPy 3:
inputText = ''
theseKeys = '' shift_flag = FALSE
n= len(theseKeys) i = 0 while i < n: if theseKeys[i] == 'return': # pressing RETURN means time to stop continueRoutine = False break elif theseKeys[i] == 'backspace': inputText = inputText[:-1] # lose the final character i = i + 1 elif theseKeys[i] == 'space': inputText += ' ' i = i + 1 elif theseKeys[i] in ['lshift', 'rshift']: shift_flag = True i = i + 1 else: if len(theseKeys[i]) == 1: # we only have 1 char so should be a normal key, # otherwise it might be 'ctrl' or similar so ignore it if shift_flag: inputText += chr( ord(theseKeys[i]) - ord(' ')) shift_flag = False else: inputText += theseKeys[i] i = i + 1
Now when I try to run this code, I get this error:
I suspect there is a simpler way to do this now, but everything I can find online is this or older. I don’t want a dialogue box.