building games with pygame method check to see that you have called pygame init(note that you can initialise individual pygame modules (for example the pygame font module can be initialised using pygame font init()if required however pygame init(is the most commonly used approach to setting up pygame set up the display once you have initialised the pygame framework you can setup the display in the above code examplethe display is set up using the pygame display set_mode(function this function takes tuple specifying the size of the window to be created (in this case pixels wide by pixels highnote that if you try and invoke this function by passing in two parameters instead of tuplethen you will get an error this function returns the drawing surface or screen/window that can be used to display items within the game such as iconsmessagesshapes etc as our example is so simple we do not bother saving it into variable howeveranything more complex than this will need to do so we also set the window/frame' caption (or titlethis is displayed in the title bar of the window render the display we now call the pygame display update(function this function causes the current details of the display to be drawn at the moment this is blank window howeverit is common in games to perform series of updates to the display in the background and then when the program is ready to update the display to call this function this batches series of updates and the causes the display to be refreshed in complex display it is possible to indicate which parts of the display need to be redrawn rather than redrawing the whole window this is done by passing parameter into the update(function to indicate the rectangle to be redrawn howeverour example is so simple we are ok with redrawing the whole window and therefore we do not need to pass any parameters to the function main game playing loop it is common to have main game playing loop that drives the processing of user inputsmodifies the state of the game and updates the display this is represented above by the while runningloop the local variable running is initialised to true this means that the while loop ensures that the game continues until the user selects to quit the game at which point the running variable is set to false which causes the loop to exit in many cases this loop will call update(to refresh the display the above example does not do this as nothing is changed in the display however the example developed later in this will illustrate this idea monitor for events that drive the game as mentioned earlier the event queue is used to allow user inputs to be queued and then processed by the game in the simple example shown above this is represented by for loop that receives events using pygame event get(and then checking to see if the event is pygame quit event if it isthen it sets the running flag to false which will cause the main while loop of the game to terminate quit pygame once finished in pygame any module that has an init(function also has an equivalent quit(function that can be used to perform any cleanup operations as we called init(on the pygame module at the