Are you wanting the participant to use a mouse and click on each rectangle? When they click do you want a number to appear in the rectangle (the order).
You’ll need isPressedIn
https://www.psychopy.org/api/event.html
You’ll probably need to cycle through the rectangles and then update a text component within them if they are pressed. This code might help:
However, this really depends on your level of coding. I think it will take a significant length of time to go from a static display to a fully functioning routine.
Best wishes,
Wakefield