First steps


Python is very popular programming language with multiple uses.

Python originated in 1980s and it’s main goal is to be readable by human beings (not only machines). This is why it looks simpler than other programming languages, but don’t worry - Python is very powerful!

To work with Python and Pygame you need to install few tools first to make workflow much more pleasant.


Even Pygame itself is written mostly in C, it is written for Python and thus Python is required for use of Pygame.

Install Python: Windows

First check whether your computer is running a 32-bit version or a 64-bit version of Windows, on the “System type” line of System Info page. To reach this page, try one of these methods:

  • Press Windows key and Pause/Break key at the same time

  • Open your Control Panel from the Windows menu, then navigate to System & Security, then System

  • Press the Windows button, then navigate to Settings -> System -> About

You can download Python for Windows from the website Download latest version available. At the time of writing it that is 3.8.0. If your computer is running 64-bit windows download Windows x86-64 executable installer. Otherwise download Windows x86 executable installer. After downloading installer, you should run (double-click on it) and follow the instructions here.

One thing to watch out for: During the installation, you will notice a window marked “Setup”. Make sure you tick “Add Python 3.8 to PATH” checkbox and click on “Install Now”, as shown here:



Once installation is successful verify it by opening command-line and run following command:

$ python --version
Python 3.8.0


Pipenv is powerful command-line tool to manage both virtual environment and Python packages installed to it.

Virtual environment isn’t absolutely necessary when working with Python but it is a great help. Virtual environment function is to create completely separated and isolated environment to install Python packages. This allows for example testing newer versions of packages without fear of breaking all existing software.

For more about pipenv see

Install pipenv globally using command pip install pipenv. You should see something similar as following:

$ pip install pipenv
Collecting pipenv
Using cached
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Using cached
Requirement already satisfied: setuptools>=36.2.1 in c:\users\jani\appdata\local\programs\python\python38\lib\site-packages (from pipenv) (41.2.0)
Collecting virtualenv (from pipenv)
Using cached
Collecting certifi (from pipenv)
Using cached
Requirement already satisfied: pip>=9.0.1 in c:\users\jani\appdata\local\programs\python\python38\lib\site-packages (from pipenv) (19.2.3)
Installing collected packages: virtualenv-clone, virtualenv, certifi, pipenv

Code editor

There are a lot of different editors and it largely boils down to personal preference. Most Python programmers use complex but extremely powerful IDEs (Integrated Development Environments), such as PyCharm. This tutorial deals installing, configuring and using PyCharm with Pygame later.

As a beginner, however, using IDEs are probably less suitable, here are few recommendations that are equally powerful but lot simpler.


From author:

If you’re unfamiliar with any editor and are unsure which one to pick, I recommend using Visual Studio Code.

Visual Studio Code

Visual Studio Code is source code-editor developed by Microsoft. It has support for syntax highlighting, code completion and other tools. It is fairly easy to use.

Download it here


Gedit is GNOME text editor. It’s more generic purpose text editor but it still has features like syntax highlighting and it’s well suitable for tutorial purposes.

Download it here

Sublime Text 3

Sublime Text is very popular editor with free evaluation period. Note that it’s not free.

Download it here


Atom is another popular editor. It’s free and open-source and developed by GitHub.

Download it here

Why are we installing a code editor?

You might be wondering why we are installing this special code editor software, rather than using something like Wordpad or Notepad.

The first reason is that code needs to be plain text, and the problem with programs like Word and Textedit is that they don’t actually produce plain text, they produce rich text (with fonts and formatting) using custom formats like RTF (Rich Text Format).

Second reason is that code editors are specialized for editing code, so they can provide helpful features like highlighting code with color according to it’s meaning, or automatically closing quotes for you. Some editors can even show certain type of mistakes and errors before you even run the program you have written.

You’ll see all this in action later.