Menu

Pygame vs Arcade vs Pyglet for Python Games

Three Python game libraries compared: pygame, the oldest and most used, built on SDL; Arcade, a modern sprite and physics library on OpenGL; and pyglet, a lower-level windowing and multimedia library. Code, strengths and which to choose.

This page includes runnable editors. Edit, run, and see output instantly.

Python has three well-known 2D game libraries. They make the same kinds of games but feel different to write:

  • Pygame (and pygame-ce): the oldest and most used, built on SDL. You draw on Surfaces in a loop you write.
  • Arcade: a newer library built on pyglet and OpenGL, with sprites, cameras, physics and tile maps built in.
  • pyglet: a windowing and multimedia library on OpenGL. Event handlers instead of a loop, and you build the game structure yourself.

The same moving square

Pygame, which runs here:

Arcade: you subclass arcade.Window and fill in methods that Arcade calls. Arcade's y axis points up, from the bottom of the window:

import arcade


class Game(arcade.Window):
    def __init__(self):
        super().__init__(480, 320, "Arcade")
        self.x = 240
        self.dx = 0

    def on_key_press(self, key, modifiers):
        if key == arcade.key.RIGHT:
            self.dx = 5
        elif key == arcade.key.LEFT:
            self.dx = -5

    def on_key_release(self, key, modifiers):
        if key in (arcade.key.LEFT, arcade.key.RIGHT):
            self.dx = 0

    def on_update(self, delta_time):
        self.x += self.dx

    def on_draw(self):
        self.clear()
        arcade.draw_lrbt_rectangle_filled(self.x - 20, self.x + 20, 140, 180, arcade.color.AMBER)


Game()
arcade.run()

pyglet: also event driven, with decorators on a window and a scheduled update function:

import pyglet
from pyglet.window import key

window = pyglet.window.Window(480, 320)
keys = key.KeyStateHandler()
window.push_handlers(keys)
square = pyglet.shapes.Rectangle(220, 140, 40, 40, color=(255, 196, 0))


def update(dt):
    square.x += (keys[key.RIGHT] - keys[key.LEFT]) * 300 * dt


@window.event
def on_draw():
    window.clear()
    square.draw()


pyglet.clock.schedule_interval(update, 1 / 60)
pyglet.app.run()

Side by side

PygameArcadepyglet
StyleYour own loopWindow class with callbacksEvent handlers and scheduled functions
DrawingCPU, on SurfacesGPU (OpenGL)GPU (OpenGL)
Many spritesFine for hundredsFast for thousandsFast for thousands, with batches
Built inRects, sprites, masks, sound, fontsSprites, cameras, physics engines, Tiled maps, GUIWindows, sprites, shapes, sound, video
y axisDown from the topUp from the bottomUp from the bottom
NeedsAny machine SDL runs onOpenGL 3.3 graphicsOpenGL graphics
Tutorials and answersBy far the mostGood official docsFewer for games

Which to choose

Choose pygame to learn game programming in Python: the loop is yours, the API is small, and almost any question you have has been answered somewhere. It is what these docs teach.

Choose Arcade if you want a platformer or top-down game with physics, scrolling cameras and Tiled levels without writing those parts, and your players have reasonably modern graphics.

Choose pyglet if you want a thin, fast OpenGL layer and will build your own structure on top, or need video and 3D drawing through OpenGL.

All three are free and installed with pip. For editors, scenes and publishing to phones, a full engine is the next step: see pygame vs Godot.

Frequently Asked Questions

Is Arcade better than pygame?

Arcade has more built in (cameras, physics engines, Tiled map loading, fast GPU sprites) and a modern API. Pygame has far more tutorials, answers and example games, and runs on more machines. For a first game either works; pygame is easier to find help for.

What is the difference between pygame and pyglet?

Pygame gives you a pixel Surface to draw on in a loop you write. Pyglet gives you an OpenGL window driven by event handlers, with batches of sprites drawn by the GPU. Pyglet is lower level for games but faster for many sprites.

What is the best Python library for making games?

For learning and small 2D games, pygame (or pygame-ce) because of its huge community. Arcade if you want built-in physics and cameras. Pyglet if you want a light OpenGL layer to build on. For large or 3D games, an engine such as Godot.

Coddy programming languages illustration

Learn to code with Coddy

Get started