How to get the keyboard to stop monitoring presses after the first response is made

I am creating an experiment where the participant sees a fixation cross, then stimulus, then responds. I am sending triggers to the EEG system at stimulus and response onset. Because of a weird anamoly with the eyetracker, I need to have part of the duration of the fixation cross show up after the response.

The issue is that, because pressing the key does not terminate the routine, it is sending response triggers to the EEG system if they press buttons after their first response, which messes with the ISI and records responses when there was no stimulus.

I need to figure out how to stop monitoring the keyboard, but I need to use the older event.getKeys command.

Here is what I have:

kb = event.getKeys(timeStamped = True)

if congruent == True and WM_easy == True: 
      if len(kb) > 0:
           if 'slash' in kb[0]:
               IncorrectPort.setData(101)
               respPortSent = True
               timeStarted = t + 0.1 
           if 'z in kb[0]:
               CorrectPort.setData(102)
               respPortSent = True
               timeStarted = t + 0.1 


if respPortSent == True and t >=timeStarted:
    IncorrectPort.setData(0)
    CorrectPort.setData(0)
    congruent = False

if respPortSent == True and t >=(timeStarted + 1):
     continueRoutine = False

I need to know how I can stop monitoring the keyboard. Preferably with the old event.getkeys way (I tried the new way and it wasn’t working).

You could set keypressed = 0 in Begin Routine and then put your Each Frame code in an if keypressed == 0: conditional with the additional line keypressed = 1