Skip to the content.

Software Installation!

đź”— Getting Started

  • Download and Install VSCode to your computer.
  • On Windows
    • Open the Microsoft Store, Download and Install “Python 3.9”.
  • On Mac
  • Open VSCode and make a new file named “first.py”. And copy the following contents into it:
import pygame
import sys

# set up pygame
pygame.init()

# set up the window
windowSurface = pygame.display.set_mode((500, 400), 0, 32)
pygame.display.set_caption('Welcome to Making a Game of It')

# set up the colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)

# set up fonts
basicFont = pygame.font.SysFont(None, 48)

# set up the text
text = basicFont.render('Hello World!', True, WHITE, BLUE)
textRect = text.get_rect()
textRect.centerx = windowSurface.get_rect().centerx
textRect.centery = windowSurface.get_rect().centery

# draw the text onto the surface
windowSurface.blit(text, textRect)

# draw the window onto the screen
pygame.display.update()

# run the game loop
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

  • Check that in the bottom right corner of VSCode it says something like “Python 3.9.6 64-bit (windows store)” for Windows or “Python 3.9.6 64-bit”.
  • If it doesn’t, click on the Python version and then in the dropdown, select the version of python that says the appropriate name in it.
  • From the “Terminal” menu of VSCode, select “New Terminal”. Then in the terminal subwindows that just opened up, type “pip3 install pygame” and press Enter.
    • This should install the PyGame library to ther version of python you installed from the Microsoft Store.
  • Lastly, you will ned to install two extensions for VSCode, which can be found by going to VSCode’s View menu and selecting “Extensions”. Then search and install the “Python” and “Live Share” extensions from the VSCode Marketplace.
    • The “Python” extension will add nice color syntax highlighting and make it easier to use python.
    • The “Live Share” extension will allow you to collaborate with other students (and the instructors) on your code in real-time (kinda like Google docs).
  • To test that Python and PyGame are install correctly, right click on the contents of the first.py file and select “Run Python file in terminal”. This should open a window that says, “Hello World!”.
  • To test the Live Share extension, click on the icon of a circle with a rightward arrow over it. You will be prompted to sign into either GitHub or Microsoft. Sign in (and make an account if needed). Once logged in, you should be able to see a collaboration session URL (something like this https://prod.liveshare.vsengsaas.visualstudio.com/join?38CF4947FD6A8A8068292B473B2F3AE954 ). You can give your URL to anyone else so that they can join your coding session and help you with your Python.