OS (e.g. Win10): Win8
PsychoPy version (e.g. 1.84.x): 1.84.2
Standard Standalone? (y/n) If not then what?: y
I am building an experiment where participants read sentences on a word-by-word basis. I want each word to display for 0.5 seconds plus an additional 0.17 seconds per letter in the word.
The code I have is as follows (found in another helpful discussion):
In code component ‘Begin Routine’:
words = sentence.split() numWords = len(words) totalDuration = numWords * 0.5 currentWordIndex = -1
In code component ‘Each frame’:
checkIndex = int(t/0.5) if checkIndex < numWords: if checkIndex != currentWordIndex: currentWordIndex = checkIndex text.setText(words[currentWordIndex]) # update to the current word
I am aware that the above has each word presented for 0.5 seconds only.
Any help would be much appreciated!