pygame (the library) is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.
.. image:: https://raw.githubusercontent.com/pygame/pygame/main/docs/pygame_logo.gif :width: 200 :height: 70 :alt: pygame
|TravisBuild| |AppVeyorBuild| |LaunchpadBuild| |PyPiVersion| |PyPiLicense| |Python2| |Python3| |GithubCommits| |LGTMAlerts| |LGTMGradePython| |LGTMGradeC| |Coverity|
pygame_ is a free and open-source cross-platform library for the development of multimedia applications like video games using Python. It uses the
Simple DirectMedia Layer library_ and several other popular libraries to abstract the most common functions, making writing these programs a more intuitive task.
We need your help_ to make pygame the best it can be! New contributors are welcome.
pip install pygame
If you are just getting started with pygame, you should be able to get started fairly quickly. Pygame comes with many tutorials and introductions. There is also full reference documentation for the entire library. Browse the documentation on the
The online documentation stays up to date with the development version of pygame on github. This may be a bit newer than the version of pygame you are using. To upgrade to the latest full release, run
pip install pygame --upgradein your terminal.
Best of all, the examples directory has many playable small programs which can get you started playing with the code right away.
If you want to use features that are currently in development, or you want to contribute to pygame, you will need to build pygame locally from its source code, rather than pip installing it.
Installing from source is fairly automated. The most work will involve compiling and installing all the pygame dependencies. Once that is done, run the
setup.pyscript which will attempt to auto-configure, build, and install pygame.
Much more information about installing and compiling is available on the
Compilation wiki page_.
Thanks to everyone who has helped contribute to this library. Special thanks are also in order.
Thanks to those sending in patches and fixes: Niki Spahiev, Gordon Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman, Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen, Herve Cauwelier, James Mazer, Lalo Martins, Timothy Stranex, Chad Lester, Matthias Spiller, Bo Jangeborg, Dmitry Borisov, Campbell Barton, Diego Essaya, Eyal Lotem, Regis Desgroppes, Emmanuel Hainry, Randy Kaelber Matthew L Daniel, Nirav Patel, Forrest Voight, Charlie Nolan, Frankie Robertson, John Krukoff, Lorenz Quack, Nick Irvine, Michael George, Saul Spatz, Thomas Ibbotson, Tom Rothamel, Evan Kroske, Cambell Barton.
And our bug hunters above and beyond: Angus, Guillaume Proux, Frank Raiser, Austin Henry, Kaweh Kazemi, Arturo Aldama, Mike Mulcheck, Michael Benfield, David Lau
There's many more folks out there who've submitted helpful ideas, kept this project going, and basically made our life easier. Thanks!
Many thank you's for people making documentation comments, and adding to the pygame.org wiki.
Also many thanks for people creating games and putting them on the pygame.org website for others to learn from and enjoy.
Lots of thanks to James Paige for hosting the pygame bugzilla.
Also a big thanks to Roger Dingledine and the crew at SEUL.ORG for our excellent hosting.
Pygame is obviously strongly dependent on SDL and Python. It also links to and embeds several other smaller libraries. The font module relies on SDLtff, which is dependent on freetype. The mixer (and mixer.music) modules depend on SDLmixer. The image module depends on SDLimage, which also can use libjpeg and libpng. The transform module has an embedded version of SDLrotozoom for its own rotozoom function. The surfarray module requires the Python NumPy package for its multidimensional numeric arrays. Dependency versions:
This library is distributed under
GNU LGPL version 2.1_, which can be found in the file
docs/LGPL.txt. We reserve the right to place future versions of this library under a different license.
This basically means you can use pygame in any project you want, but if you make any changes or additions to pygame itself, those must be released with a compatible license (preferably submitted back to the pygame project). Closed source and commercial games are fine.
The programs in the
examplessubdirectory are in the public domain.
See docs/licenses for licenses of dependencies.
.. |TravisBuild| image:: https://travis-ci.org/pygame/pygame.svg?branch=master :target: https://travis-ci.org/pygame/pygame
.. |AppVeyorBuild| image:: https://ci.appveyor.com/api/projects/status/x4074ybuobsh4myx?svg=true :target: https://ci.appveyor.com/project/pygame/pygame
.. |LaunchpadBuild| image:: https://www.pygame.org/images/launchpad_build.svg?svg=true :target: https://code.launchpad.net/~pygame/+recipe/pygame-daily
.. |PyPiVersion| image:: https://img.shields.io/pypi/v/pygame.svg?v=1 :target: https://pypi.python.org/pypi/pygame
.. |PyPiLicense| image:: https://img.shields.io/pypi/l/pygame.svg?v=1 :target: https://pypi.python.org/pypi/pygame
.. |Python2| image:: https://img.shields.io/badge/python-2-blue.svg?v=1 .. |Python3| image:: https://img.shields.io/badge/python-3-blue.svg?v=1
.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame/pygame/2.0.0.svg :target: https://github.com/pygame/pygame/compare/2.0.0...main
.. |LGTMAlerts| image:: https://img.shields.io/lgtm/alerts/g/pygame/pygame.svg?logo=lgtm&logoWidth=18 :target: https://lgtm.com/projects/g/pygame/pygame/alerts/
.. |LGTMGradePython| image:: https://img.shields.io/lgtm/grade/python/g/pygame/pygame.svg?logo=lgtm&logoWidth=18 :target: https://lgtm.com/projects/g/pygame/pygame/context:python
.. |LGTMGradeC| image:: https://img.shields.io/lgtm/grade/cpp/g/pygame/pygame.svg?logo=lgtm&logoWidth=18 :target: https://lgtm.com/projects/g/pygame/pygame/context:cpp
.. |Coverity| image:: https://scan.coverity.com/projects/12288/badge.svg?v=2 :target: https://scan.coverity.com/projects/pygame
.. _pygame: https://www.pygame.org .. _Simple DirectMedia Layer library: https://www.libsdl.org .. _We need your help: https://www.pygame.org/contribute.html .. _Compilation wiki page: https://www.pygame.org/wiki/Compilation .. _docs page: https://www.pygame.org/docs/ .. _GNU LGPL version 2.1: https://www.gnu.org/copyleft/lesser.html