more interactive pygame application print('initialising box game'display_surface pygame display set_mode(( )pygame display set_caption('box game'print('update display'pygame display update(print('setup the clock'clock pygame time clock(clear the screen of current contents display_surface fill(backgroundprint('starting main game playing loop'running true while runningfor event in pygame event get()if event type =pygame quitprint('received quit event:'eventrunning false elif event type =pygame mousebuttondownprint('received mouse event'eventxy event pos pygame draw rect(display_surfaceblue[xywidthheight]update the display pygame display update(defines the frame rate the number of frames per second should be called once per frame (but only onceclock tick(frame_refresh_rateprint('game over'now tidy up and quit python pygame quit(if __name__ ='__main__'main(note that we now need to record the display surface in local variable so that we can use it to draw the blue rectangles we also need to call the pygame display update(function each time round the main while loop so that the new rectangles we have drawn as part of the event processing for loop are displayed to the user we also set the frame rate each time round the main while loop this should happen once per frame (but only onceand uses the clock object initialised at the start of the program