How to change the images with keypress

I am designing an experiment which one image is displayed on the screen. The participant can change images with slider and choose one of which with keypress.
I only learn how to use the builder.How can I find the the right code to make it
Thanks.

Please could you clarify what you mean by this?

change the images and every time only show one image on the screen .Participants can choose one of the images by keypress.
thanks

So, for example:

5 images presented for 2 seconds each in a random order (doable with a spreadsheet, a loop and an image component)

After the images have been presented the participant makes their selection using a number (text component and keyboard component in a routine after the loop)

Or

5 images presented for 2 seconds each in a random order where the participant can press a key to select the image on screen (doable with a spreadsheet, a loop, an image component and a keyboard component).

A small amount of code might be needed if you want to store the selected image for later display or end the loop once a selection has been made.

the latter
5 images presented for 2 seconds each in a random order where the participant can press a key to select the image on screen (with an image component and a keyboard component).

And I need store the data of which image was selected for each trial

if key_resp.keys: # Something has been pressed.
     selectedImage = Image # Ignore this line if you only want to save the data
     thisExp.addData('Selected',Image) # If Image is the name of your image column in your spreadsheet
     trials_2.finished = True # If you want to stop the loop (called trials_2) presenting the images when an image has been selected