OS: OSX El Capitan 10.11.6
PsychoPy version: 1.84.1
Standard Standalone? (y/n): Yes
**What are you trying to achieve?: To provide feedback after the participant enters a YES / NO response in post-stimulus comprehension questions.
**What did you try to make it work?: Read the manual and tried to check if there is something wrong with the coding.
**What specifically went wrong when you tried that?: Comprehension questions and feedback appear at the same time on the screen. It seems the feedback text is not properly linked to the previous response command.
# get current time
t = question_1Clock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *text_4* updates if t >= 0.0 and text_4.status == NOT_STARTED: # keep track of start time/frame for later text_4.tStart = t text_4.frameNStart = frameN # exact frame index text_4.setAutoDraw(True) # *key_resp_question1* updates if t >= 0.0 and key_resp_question1.status == NOT_STARTED: # keep track of start time/frame for later key_resp_question1.tStart = t key_resp_question1.frameNStart = frameN # exact frame index key_resp_question1.status = STARTED # keyboard checking is just starting key_resp_question1.clock.reset() # now t=0 if key_resp_question1.status == STARTED: theseKeys = event.getKeys(keyList=['y', 'n']) # check for quit: if "escape" in theseKeys: endExpNow = True if len(theseKeys) > 0: # at least one key was pressed key_resp_question1.keys = theseKeys[-1] # just the last key pressed key_resp_question1.rt = key_resp_question1.clock.getTime() # was this 'correct'? if (key_resp_question1.keys == str(u'y')) or (key_resp_question1.keys == u'y'): key_resp_question1.corr = 1 else: key_resp_question1.corr = 0 # a response ends the routine continueRoutine = False # *Feedback_1* updates if t >= 0.0 and Feedback_1.status == NOT_STARTED: # keep track of start time/frame for later Feedback_1.tStart = t Feedback_1.frameNStart = frameN # exact frame index Feedback_1.setAutoDraw(True) if Feedback_1.status == STARTED: # only update if drawing Feedback_1.setText(msg, log=False) # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in question_1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # check for quit (the Esc key) if endExpNow or event.getKeys(keyList=["escape"]): core.quit() # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip()
Coding is not my business. I’d appreciate it if you could guide how to work this out.
Thank you very much for sharing this wonderful app.