Pygame 首页 Pygame Front Page

文档 Documents

简介 Readme

Basic information about pygame: what it is, who is involved, and where to find it.

安装 Install

Steps needed to compile pygame on several platforms. Also help on finding and installing prebuilt binaries for your system.

文件路径函数参数 File Path Function Arguments

How pygame handles file system paths.

LGPL 许可 LGPL License

This is the license pygame is distributed under. It provides for pygame to be distributed with open source and commercial software. Generally, if pygame is not changed, it can be used with any type of program.

教程 Tutorials

Pygame 介绍 Introduction to Pygame

An introduction to the basics of pygame. This is written for users of Python and appeared in volume two of the Py magazine.

导入和初始化 Import and Initialize

The beginning steps on importing and initializing pygame. The pygame package is made of several modules. Some modules are not included on all platforms.

如何移动一张图片? How do I move an Image?

A basic tutorial that covers the concepts behind 2D computer animation. Information about drawing and clearing objects to make them appear animated.

拳击黑猩猩(游戏)逐行教程 Chimp Tutorial, Line by Line

The pygame examples include a simple program with an interactive fist and a chimpanzee. This was inspired by the annoying flash banner of the early 2000s. This tutorial examines every line of code used in the example.

精灵模块介绍 Sprite Module Introduction

Pygame includes a higher level sprite module to help organize games. The sprite module includes several classes that help manage details found in almost all games types. The Sprite classes are a bit more advanced than the regular pygame modules, and need more understanding to be properly used.

图层数组介绍 Surfarray Introduction

Pygame used the NumPy python module to allow efficient per pixel effects on images. Using the surface arrays is an advanced feature that allows custom effects and filters. This also examines some of the simple effects from the pygame example,

相机模块介绍 Camera Module Introduction

Pygame, as of 1.9, has a camera module that allows you to capture images, watch live streams, and do some basic computer vision. This tutorial covers those use cases.

新手指南 Newbie Guide

A list of thirteen helpful tips for people to get comfortable using pygame.

游戏制作教程 Making Games Tutorial

A large tutorial that covers the bigger topics needed to create an entire game.

显示模式 Display Modes

Getting a display surface for the screen.

参考 Reference

索引 Index

A list of all functions, classes, and methods in the pygame package.

缓冲代理 pygame.BufferProxy

An array protocol view of surface pixels

颜色 pygame.Color

Color representation.

光标 pygame.cursors

Loading and compiling cursor images.

显示 pygame.display

Configure the display surface.

绘制 pygame.draw

Drawing simple shapes like lines and ellipses to surfaces.

事件 pygame.event

Manage the incoming events from various input devices and the windowing platform.

示例 pygame.examples

Various programs demonstrating the use of individual pygame modules.

字体 pygame.font

Loading and rendering TrueType fonts.

自由类型(字体) pygame.freetype

Enhanced pygame module for loading and rendering font faces.

gfx 绘制 pygame.gfxdraw

Anti-aliasing draw functions.

图片 pygame.image

Loading, saving, and transferring of surfaces.

摇杆 pygame.joystick

Manage the joystick devices.

按键 pygame.key

Manage the keyboard device.

常量 pygame.locals

Pygame constants.

混音器 pygame.mixer

Load and play sounds

鼠标 pygame.mouse

Manage the mouse device and display.


Play streaming music tracks.


Top level functions to manage pygame.

像素数组 pygame.PixelArray

Manipulate image pixel data.

矩形 pygame.Rect

Flexible container for a rectangle.

碎片(剪切板) pygame.scrap

Native clipboard access.

声样数组 pygame.sndarray

Manipulate sound sample data.

精灵 pygame.sprite

Higher level objects to represent game images.

图层 pygame.Surface

Objects for images and the screen.

图层数组 pygame.surfarray

Manipulate image pixel data.

测试 pygame.tests

Test pygame.

时间 pygame.time

Manage timing and framerate.

变形 pygame.transform

Resize and move images.

C 语言接口 pygame C API

The C api shared amongst pygame extension modules.

页面搜索 Search Page

Search pygame documents by keyword.

在 Github 上编辑 Edit on GitHub