for alpha in range(startendanimationspeed step)animation loop alpha means transparency is opaque is invisible checkforquit( flashsurf fill((rgbalpha) displaysurf blit(origsurf( ) displaysurf blit(flashsurf( ) drawbuttons( pygame display update( fpsclock tick(fps def getbuttonclicked(xy) if yellowrect collidepoint(xy) return yellow elif bluerect collidepoint(xy) return blue elif redrect collidepoint(xy) return red elif greenrect collidepoint(xy) return green return none if __name__ ='__main__' main(the usual starting stuff simulate ( simon clone by al sweigart al@inventwithpython com creative commons by-nc-sa us import randomsystimepygame from pygame locals import fps windowwidth windowheight flashspeed in milliseconds flashdelay in milliseconds buttonsize buttongapsize timeout seconds before game over if no button is pushed email questions to the authoral@inventwithpython com