If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): PsychoPy version (e.g. 1.85.3.x): Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I want to make an experiment that show a polygon with random color (blue & red ) and give a feed back if answer is true (b for blue & r for red)
What did you try to make it work?:
i didn’t have any problem with all the experiment except of feedback
for this case first time i used this guide : http://www.psychopy.org/recipes/builderFeedback.html
so my code in begin Routine was like this :
if not key_resp.keys :
msg=“Failed to respond”
elif resp.corr:#stored on last run routine
msg=“Correct! RT=%.3f” %(resp.rt)
else:
msg=“Oops! That was wrong”
with this case i got an error : that said : ‘key_resp’ is not defined
i seen other topics like my problem and some of them said key_resp should be change so i did this :
That code is running just once, at the start of the routine, before key_resp2 has even had a chance to run. So there will never be valid reaction time.
This code is designed to run after the keyboard has completed. So:
set the keyboard component to end the routine.
insert a new routine after the current one and put the text component and code component there.
PS This was a good question, in that it provided all the detail required to answer it.
Your letter height is 3. You need to check what units the stimulus is using (on the advanced tab) and choose something that will make it visible (e.g. 3 pixels may be too small, 3 in norm units is too large).
Also be careful when you set the parameters to update. The letter height is constant, and so doesn’t need to be set on every frame (typically 60 times per second). Similarly, the text just changes once per repeat (i.e. every trial), again, not continuously.
The keyboard component isn’t clever enough to do this. You’ll need to delete it and handle the keypress checking yourself, in code. The code will need to move into the “each frame” tab of a code component on the first routine. On that routine, also insert a sound component to serve as your alarm, but don’t give it a start time time (you’ll play it in code).
response = event.getKeys()
if response: # if there is a keypress in the list:
if your_correct_response_variable_name in response:
thisExp.addData('rt', t) # save the RT in the data (need to do this manually now).
msg = 'Correct!!'
continueRoutine = False # move on to the next routine
else:
your_sound_component_name.play() # signal an error
Note that setting the value of msg here is actually no longer needed, as the text component could just be set to show a constant value of 'Correct!!', as the the next routine will now only ever appear when a correct response has been made.