psychopy.org | Reference | Downloads | Github

Feedback Problem

I have a program with multiple loops that I’ve been updating from a previous version to 1.83.04 on a windows 7. In the first loop, my feedback is working correctly. For the second, I’m following a similar code, but the key responses aren’t registering. I have key responses set for feedback and a rating scale and I can’t get any responses to go through. The scale does not move with the keys I have set and the feedback messages always display that the answer was incorrect.

The script is very long and I’m not really sure where I need to make changes to fix this problem. I can post the whole script if necessary, but this is the portion that begins the loop sequence I’m having issues with. Any suggestions?

t = 0
Sequence1Clock.reset() 
frameN = -1
routineTimer.add(1.800000)
key_resp_5 = event.BuilderKeyResponse() 
key_resp_5.status = NOT_STARTED
Sequence2Components = []
Sequence2Components.append(key_resp_5)
Sequence2Components.append(rating_2)
for thisComponent in Sequence2Components:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:

    if t >= 0 and key_resp_5.status == NOT_STARTED:
        key_resp_5.tStart = t 
        key_resp_5.frameNStart = frameN 
        key_resp_5.status = STARTED
        win.callOnFlip(key_resp_5.clock.reset)  
        event.clearEvents(eventType='keyboard')
    if key_resp_5.status == STARTED and t >= (0 + (1.8-win.monitorFramePeriod*0.75)): #most of one frame period left
        key_resp_5.status = STOPPED
    if key_resp_5.status == STARTED:
        theseKeys = event.getKeys(keyList=['b', 'm'])
        
        if len(theseKeys) > 0:  
            key_resp_5.keys = theseKeys[-1] 
            key_resp_5.rt = key_resp_5.clock.getTime()
            # was this 'correct'?
            if (key_resp_5.keys == str(corrAns)) or (key_resp_5.keys == corrAns):
                key_resp_5.corr = 1
            else:
                key_resp_5.corr = 0
    if t >= 0.0 and rating_2.status == NOT_STARTED:
        rating_2.tStart = t  
        rating_2.frameNStart = frameN 
        rating_2.setAutoDraw(True)
    continueRoutine &= rating_2.noResponse