4.2.3 - Windows

So far, the programs that wrote created only printed text to the CLI area. Those programs did not open any windows like most modern programs do. The code to open a window is not complex. Below is the required code, which creates a window sized to a width of 700 pixels, and a height of 500:

Opening and setting the window size :

>>> size = (700, 500) # Size can also be either a tuple or a list. Which do you think is better?

>>> screen = pygame.display.set_mode(size)

With the second command pygame is not opening a window but it is setting the parameters (size) of the window. Size is also a list of two numbers. 

We can also set the title of the window with the command :

>>> pygame.display.set_caption("My Game")