titlerect center (int(windowwidth int(windowheight displaysurf blit(titlesurftitlerect draw the additional "press key to play text presskeysurfpresskeyrect maketextobjs('press key to play 'basicfonttextcolor presskeyrect center (int(windowwidth )int(windowheight displaysurf blit(presskeysurfpresskeyrect while checkforkeypress(=none pygame display update( fpsclock tick( def checkforquit() for event in pygame event get(quit)get all the quit events terminate(terminate if any quit events are present for event in pygame event get(keyup)get all the keyup events if event key =k_escape terminate(terminate if the keyup event was for the esc key pygame event post(eventput the other keyup event objects back def calculatelevelandfallfreq(score) based on the scorereturn the level the player is on and how many seconds pass until falling piece falls one space level int(score fallfreq (level return levelfallfreq def getnewpiece() return random new piece in random rotation and color shape random choice(list(shapes keys()) newpiece {'shape'shape 'rotation'random randint( len(shapes[shape] ) ' 'int(boardwidth int(templatewidth ) ' '- start it above the board ( less than 'color'random randint( len(colors)- ) return newpiece def addtoboard(boardpiece) fill in the board based on piece' locationshapeand rotation for in range(templatewidth)email questions to the authoral@inventwithpython com