Send a trigger code just when a key pressed

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.84.x):
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I want to show 32 random pics then subject should press any key, but I don’t know how we can send a trigger code just after a key pressing.
What did you try to make it work?:

What specifically went wrong when you tried that?: when I put a parallel routine in a trial, the trigger code sent even there was no key pressing.
Include pasted full error message if possible. “That didn’t work” is not enough information.