#=====================
#START TRIAL
#=====================
#-draw fixation
#-flip window
#-wait time (stimulus duration)
#-draw image
#-flip window
#-wait time (stimulus duration)
#-draw end trial text
#-flip window
#-wait time (stimulus duration)
Adjust your experiment so that it follows frame-based timing rather than clock timing (comment out the clock-based timing code in case you want to use it again) using for loops and if statements.
Add a "dropped frame" detector to your script to find out whether your experiment is dropping frames. How many total frames are dropped in the experiment? If 20 or fewer frames are dropped in the whole experiment (1 frame per trial), keep frame-based timing in your experiment. Otherwise, switch back to the CountdownTimer.