Can Python Be Used To Make Games?

By Bernie FitzGerald •  Updated: 12/27/22 •  5 min read

Yes, absolutely Python can be used to make games. Several libraries and frameworks are built specifically for game-making in Python.

In this article, I will review two top ways developers build games in Python. I will briefly examine how to distribute your game once you’ve built it. 

It is possible to make and deploy games written in Python, but you should look into tools or platforms like Unity or Unreal Engine for any serious game development tasks. Python is a great beginner language, and this, combined with something like PyGame, can really help developers get a feel for game development, but probably not for releasing games.


According to, PyGame is a set of Python modules designed for writing video games. PyGame is also platform independent, so any game you build using it could be run on different platforms and operating systems like Windows, macOS and Linux.

PyGame is built on the SDL (Simple DirectMedia Layer) development library.

PyGame is installed using pip, and there is an example game, pygame.examples.aliens, that is installed with the tools that can be run to ensure your computer is ready to build games in PyGame.



Pyglet is another cross-platform library for Python. Pyglet is described as a windowing and multimedia library for Python. It is a powerful yet easy-to-use library. 

Pyglet has no external dependencies; it only requires Python to run. With native windowing, BSD licencing, built-in support for images and audio and the fact that it is written in pure Python, Pyglet is a good choice for building a game.

A quick example of displaying the text Hello World in a window is one example that comes with the examples from GitHub.

Pyglet Hello World

As you can see, a very short amount of code can produce the following output using Pyglet:

Pyglet Hello World Output

Distributing your game

To distribute a game you’ve built in Python, you’ll need to package up the application first. You will also need to know a little bit about the audience that you are distributing to. 

For example, if the game is just to be shared by you with other game developers, or friends and family, you could zip the source code files up and let them know to unzip, install python and run the app.

If you want to sell your game on the open market, you will have to distribute the game in a way that makes it easy for end users to install and play. This means that devices without python will have to get python installed at the same time you install your game.

There are several packages and online tutorials that you can follow to package up your application. One distribution platform that you could use for Python games is is an open marketplace where game developers or digital creators can host and share their work. You can put your games up online quickly and easily for anyone to download and play. You can also set up payments if you want to sell your game on

 A quick search of the keyword Python in the search box results in over 40 Python-related games and projects.

Why not use Python for game development?

The first reason not to use Python for game development would be speed. As Python is an interpreted language and not a compiled language, if your game requires speed, then Python wouldn’t be the first language to look at.

The second reason is that there are far better tools available for game developers than Python and specific Python libraries. For instance, the Unity development platform has built-in tools for building 2D, 3D, VR and AR applications, all from within the same tool suite.

On top of this, the engine allows developers to write code in C#, a nice high-level language as opposed to C++, which can be daunting to beginner game developers.

Unity also has a streamlined building and deployment tool that makes it easy to bundle your game and get it in front of users quickly. 

Unity also covers implementation details of multiplayer, image, video and sound handling are also taken care of, allowing developers to focus on their game details rather than boilerplate code.


Should Python be used at all in game development?

Yes. Python is used heavily as a scripting tool within games. You will find uses of Python in games like Civilization. This is because you could quickly script up the ability to trigger events or handle in-game situations that may not require full back-end graphics handling.

An example in Civ IV is that the game interface is heavily built using Python scripts. As these scripts can be generated automatically by the game engine, you can change the entire game menus by changing the Python script.

By extracting these details into Python scripts, the developer can make modifications to the game in an easy-to-reason-about format, as opposed to the underlying C++ in which the game is written.


Python is a great language for learning game development. There are several libraries that you can use to build full-featured games. However, if you build the next big game using Python, you might be better off using a more fully-featured game-building tool or frameworks like Unity or Unreal engine.

Bernie FitzGerald