I’m doing an experiment in Psychopy using Python.
I have a problem: I want to ask my subjects to hold the spacebar and as soon as they press I want the windows screen to change and when they release that I want the windows screen to change once more.
I tried to read the documentation and I can only find event.getKeys, but I dont know if I can set I want to record the two answers. I’m trying the code below, but sometimes it works, sometimes it doesn’t.
win = visual.Window(
size = [1920,1080],
fullscr = False
intro = visual.TextStim(win, height=0.09, font= “Arial”)
intro.text = “ciao”
intro_loop = True
intro_keys = kb.getKeys([“s”], waitRelease=True)
if len(intro_keys): win.close() intro_loop=False