Tutorial Code not Registering Key Press

Hello,

the attached code closely followed coder tutorial part 2 from the official website. For some reason the code recognizes key presses during the ‘welcome screen’ but it does not register in the next screen. I was not sure why this was occuring. Would very much appreciate your feedback. Thanks
tutorialerror.py (3.4 KB)

Hi There,

Please may you share the link to which tutorial you are following ? Looking at your code I am unsure which tutorial this is!

It looks like you are entering a stimulus presentation loop where no key presses are yet being watched, so it will feel like nothing is responsive i.e.:

for thisIncrement in staircase:  # staircase was initialized before. from it we get element thisIncrement.
    # set location of stimuli
    targetSide= random.choice([-1,1])  # will be either +1(right) or -1(left)
    foil.setPos([-5*targetSide, 0])
    target.setPos([5*targetSide, 0])  # in other location

    # set orientation of probe
    foil.setOri(expInfo['refOrientation'] + thisIncrement) #every loop it sets the orientation of the foil image by getting the orientation in expInfo and adding thisIncrement component.

    # draw all stimuli
    foil.draw()
    target.draw()
    fixation.draw()
    win.flip()

Thanks!

appreciate the help! Tutorial 2: Measuring a JND using a staircase procedure — PsychoPy v2022.2.4

Hi Chris,

Ok I suspect this might be an indentation thing - the while loop in this section needs to be in the same loop as your stimulus presentation loop - hope that helps!

Becca

thats exactly what it was. Thank you so much!