Yes, that makes sense. If you look at the compiled python code for the example you sent, you can see that on each frame the custom keyboard kb
is being checked first, followed by the keyboard component key_resp
that was in the project. key_resp
will consume / clear any keyboard events not first picked up by keyboard kb
:
snippet from compiled code:
keys = kb.getKeys(['f', 's'], waitRelease=False, clear=False)
# Get and clear key when released
keys_released = kb.getKeys(['f', 's'], waitRelease=True, clear=True)
if keys:
print("pressed: ", [(k.rt, k.name) for k in keys])
if keys_released:
print("released: ", [(k.rt, k.name, k.duration) for k in keys_released])
# *key_resp* updates
waitOnFlip = False
if key_resp.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance:
# keep track of start time/frame for later
# ....
if key_resp.status == STARTED and not waitOnFlip:
theseKeys = key_resp.getKeys(keyList=None, waitRelease=False)
# ....