I am coding an Moving Window paradigm. In this experiment, I need to press “space” everytime to print a word of a list. Here are my problems:
1.It should show me the first word “I” when I first press “space”, but I get a [ ]
2.At the end of the experiment, the outcome shoul be “I am a Hero !”, but it shows me [‘I’,‘am’,‘a’,‘Hero’]. I don’t need [’’,’’,’’,’’] and the last word missed.
Here is my code:
from psychopy import core, visual, event win = visual.Window(color = 'white') Text1 = ['I','am','a','Hero','!'] for i in range(5): key = event.waitKeys(keyList = ['space','escape']) if key == ['space']: Text_1 = visual.TextBox2(win, text = Text1[0:i],color = 'black', font = 'Open Sans' ) Text_1.draw() win.flip() elif key == ['escape']: win.close() core.quit()
Thank you in advance for any aid you can give me!