figure - the diagram of how blocks will bounce creating and setting up pygame and the main window import pygamesystime from pygame locals import set up pygame pygame init( set up the window windowwidth windowheight windowsurface pygame display set_mode((windowwidthwindowheight) in this programyou'll see that the size of the window' width and height is used for more than just the call to set_mode(use constant variables so that if you ever want to change the size of the windowyou only have to change lines and since the window width and height never change during the program' executiona constant variable is good idea pygame display set_caption('animation'line sets the window' caption to 'animationby calling pygame display set_caption(setting up constant variables for direction set up direction variables downleft