In the instance that the participant made the correct response, I attempted to write code that would save various variables and put some text on the screen saying that they had got the answer correct:
if (key_resp_2.keys == str(corrAns)) or (key_resp_2.keys == corrAns): key_resp_2.corr = 1 # store that the answer was correct how_many_correct += 1 # tally that the answer was correct how_many_goes +=1 # tally that 1 more go has taken place AP_correctAns = songTitle # saves the current correct stimulus title for the purpose of on screen text.. percent = int((how_many_correct/how_many_goes) * 100) # for the purpose of on screen text.. audio_stimulus.stop() # stop playing the audio_stimulus if t >= 0.0 and correct_text.status == NOT_STARTED: correct_text.tStart = t correct_text.frameNStart = frameN correct_text.setAutoDraw(True) incorrect_text.status = FINISHED audio_feedback.status = FINISHED
However, whilst most of this code worked, correct_text never appeared on screen. On the other hand, incorrect_text, as called in the else part of the statement, appears just fine:
else: key_resp_2.corr = 0 #store that the response was incorrect within key_resp_2 how_many_goes +=1 #Add one to the how_many_goes counter is_it_correct = "" #Save “” in the variable is_it_correct, so that nothing displays on screen AP_correctAns = songTitle #Store songTitle, from the conditions file, in the variable AP_correctAns, for display on screen percent = int((how_many_correct/how_many_goes) * 100) #Present the current percentage as a percentage (and an integer), for display on screen audio_stimulus.stop() #Stop the audio_stimulus audio_feedback.tStart = t #Store the current value of t as the audio_feedback tStart audio_feedback.frameNStart = frameN #Stores the frame? audio_feedback.play() #The audio feedback plays if t >= 0.0 and incorrect_text.status == NOT_STARTED: incorrect_text.tStart = t incorrect_text.frameNStart = frameN incorrect_text.setAutoDraw(True) correct_text.status = FINISHED
I’m presuming that’s because once the audio_feedback is playing, there is time for the incorrect_text to be presented, whereas when the audio_feedback is stopped there isn’t time for the correct_text to be presented? is there a good solution for this problem?