<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Pygame</id>
	<title>Pygame - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Pygame"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Pygame&amp;action=history"/>
	<updated>2026-04-23T15:02:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Pygame&amp;diff=710214&amp;oldid=prev</id>
		<title>imported&gt;Frap: /* Sample code */</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Pygame&amp;diff=710214&amp;oldid=prev"/>
		<updated>2025-08-12T13:49:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Sample code&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Python module for writing video games}}&lt;br /&gt;
{{Use dmy dates|date=September 2023}}&lt;br /&gt;
{{Infobox software&lt;br /&gt;
| title = &lt;br /&gt;
| name = Pygame&lt;br /&gt;
| logo = Pygame logo.svg&lt;br /&gt;
| logo caption = &lt;br /&gt;
| logo size = 250px&lt;br /&gt;
| screenshot = &lt;br /&gt;
| caption = &lt;br /&gt;
| collapsible = &lt;br /&gt;
| author = Lenard Lindstrom, René Dudfield, Pete Shinners, Nicholas Dudfield, Thomas Kluyver, and others&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/pygame/pygame/graphs/contributors|title=Contributors to Pygame|publisher=[[GitHub]]}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| developer = Pygame Community&lt;br /&gt;
| released = {{Start date and age|2000|10|28|df=y}}&amp;lt;ref name=&amp;quot;pygame-intro&amp;quot;&amp;gt;{{cite web |url=http://www.pygame.org/docs/tut/PygameIntro.html |title=Python Pygame Introduction - History |last=Shinners |first=Pete |website=Pygame.org |access-date=2017-04-28 |archive-url=https://web.archive.org/web/20190917011758/http://www.pygame.org/docs/tut/PygameIntro.html |archive-date=2019-09-17 |url-status=dead }}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web |url=https://pypi.python.org/pypi/Pygame/ |title=Downloads - Pygame - Python game development|website=Pypi.python.org}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| discontinued = &lt;br /&gt;
| latest release version = 2.6.1&lt;br /&gt;
| latest release date = {{Start date and age|2024|09|30|df=y}}&amp;lt;ref&amp;gt;{{cite web |url= https://github.com/pygame/pygame/releases/tag/2.6.1|access-date=2025-03-16 |title=PyGame 2.6.1 - Python 3.13 bugfix release}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| programming language = [[Python (programming language)|Python]], [[C (programming language)|C]], [[Cython]], and [[Assembly language|Assembly]]&amp;lt;ref name=&amp;quot;about&amp;quot;&amp;gt;{{cite web|url=https://www.pygame.org/wiki/about|title=About Pygame|publisher=GitHub|access-date=31 August 2019|archive-url=https://web.archive.org/web/20190918143814/http://www.pygame.org/wiki/about|archive-date=18 September 2019|url-status=dead}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=https://www.pygame.org/wiki/GettingStarted|title=GettingStarted|website=Pygame.org}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| operating system = [[Cross-platform]]&lt;br /&gt;
| platform = &lt;br /&gt;
| size = &lt;br /&gt;
| language = &lt;br /&gt;
| language count = &amp;lt;!-- DO NOT include this parameter unless you know what it does --&amp;gt;&lt;br /&gt;
| language footnote = &lt;br /&gt;
| genre = [[Application Programming Interface|API]]&lt;br /&gt;
| license = [[GNU Lesser General Public License]]&lt;br /&gt;
| alexa = &lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Pygame&amp;#039;&amp;#039;&amp;#039; is a [[cross-platform]] set of [[Python (programming language)|Python]] modules designed for writing [[video game]]s. It includes [[computer graphics]] and sound [[library (computing)|libraries]] designed to be used with the Python [[programming language]].&amp;lt;ref&amp;gt;{{Cite web |last=Alam |first=Imran |date=2023-07-02 |title=How to Implement a Dialogue System in Pygame |url=https://www.makeuseof.com/implement-dialogue-system-in-pygame/ |access-date=2024-11-29 |website=MUO |language=en}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
Pygame was originally written by [[Pete Shinners]] to replace [[PySDL]] after its development stalled.&amp;lt;ref name=&amp;quot;pygame-intro&amp;quot;/&amp;gt;&amp;lt;ref&amp;gt;{{cite web |url=https://sourceforge.net/projects/pysdl/ |title=pySDL sourceforge page|website=Sourceforge.net}}&amp;lt;/ref&amp;gt; It has been a [[free software community|community]] project since 2000&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/pygame/pygame/commit/a4e0f865c591980e7aa2a160a92a2c9098a678ec | title=commit by other authors|publisher=GitHub}}&amp;lt;/ref&amp;gt; and is released under the [[free software]] [[GNU Lesser General Public License]]&amp;lt;ref name=&amp;quot;about&amp;quot;/&amp;gt; (which &amp;quot;provides for Pygame to be distributed with [[open-source software|open source]] and commercial software&amp;quot;&amp;lt;ref&amp;gt;{{Cite web|title=Pygame Front Page — pygame v2.0.1.dev1 documentation|url=https://www.pygame.org/docs/|access-date=2021-02-26|website=www.pygame.org}}&amp;lt;/ref&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Development of version 2==&lt;br /&gt;
Pygame version 2 was planned as &amp;quot;Pygame Reloaded&amp;quot; in 2009, but development and maintenance of Pygame completely stopped until the end of 2016 with version 1.9.1. After the release of version 1.9.5 in March 2019, development of a new version 2 was active on the roadmap.&amp;lt;ref&amp;gt;{{cite web|url= https://www.pygame.org/news/2019/3/1-9-5-released-into-the-wilds | title= pygame 1.9.5 released into the wilds |website= www.pygame.org}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pygame 2.0 released on 28 October 2020, Pygame&amp;#039;s 20th anniversary.&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/pygame/pygame/releases/tag/2.0.0|title=pygame 2.0 - the happy dance birthday release|publisher=GitHub}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
Pygame uses the [[Simple DirectMedia Layer]] (SDL) library,{{Efn|name=fn1}} with the intention of allowing [[real-time computer graphics|real-time]] [[computer game]] development without the [[low-level programming language|low-level]] mechanics of the [[C (programming language)|C programming language]] and its derivatives. This is based on the assumption that the most [[computationally expensive|expensive]] functions inside games can be abstracted from the game logic, making it possible to use a [[high-level programming language]], such as Python, to structure the game.&amp;lt;ref name=&amp;quot;about&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other features that SDL does have include vector math, [[collision detection]], 2D sprite [[scene graph]] management, [[MIDI]] support, camera, pixel-array manipulation, transformations, filtering, advanced freetype font support, and drawing.&amp;lt;ref&amp;gt;{{cite web|url=https://www.pygame.org/docs/ |title=Pygame docs|website=Pygame.org}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Applications using Pygame can run on Android phones and tablets with the use of Pygame Subset for Android (pgs4a).&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/renpytom/rapt-pygame-example|title=Example of using RAPT to package pygame(_sdl2) games.: renpytom/rapt-pygame-example|date=1 April 2019|access-date=1 April 2019|publisher=GitHub}}&amp;lt;/ref&amp;gt; Sound, vibration, keyboard, and accelerometer are supported on Android.&amp;lt;ref&amp;gt;{{cite web|url=http://pygame.renpy.org/api.html |title=API — Pygame Subset for Android |access-date=14 October 2014 |url-status=dead |archive-url=https://web.archive.org/web/20141019204533/http://pygame.renpy.org/api.html |archive-date=19 October 2014 }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Community==&lt;br /&gt;
{{Anchor|pygame-ce}}&lt;br /&gt;
Following disagreements between former core developers and the repository owner, a fork known as pygame-ce (Community Edition) was created.&amp;lt;ref&amp;gt;{{cite web|url=https://pypi.org/project/pygame-ce/|title=pygame - Community Edition |website=pypi.com}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Anchor|PyWeek}}&lt;br /&gt;
There is a regular competition, called PyWeek, to write games using Python (and usually but not necessarily, Pygame).&amp;lt;ref&amp;gt;{{cite web|url=http://www.pyweek.org/|title=PyWeek - Python Game Programming Challenge|website=Pyweek.org}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=https://www.i-programmer.info/professional-programmer/i-programmer/5697-why-pyweek-an-interview-with-richard-jones-.html|title=Why PyWeek: An Interview with Richard Jones|last=Gee|first=Sue|website=i-programmer.info|date=29 March 2013|access-date=31 March 2020}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=https://wiki.python.org/moin/PyWeek|title=PyWeek - Python Wiki|website=Wiki.python.org|access-date=1 April 2019}}&amp;lt;/ref&amp;gt; The community has created many tutorials for Pygame.&amp;lt;!-- First ref is a primary source, but still relevant. Other refs clearly support this assertion --&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=http://www.pygame.org/docs/|title=pygame documentation: Tutorials|website=Pygame.org}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite web|last=Siddiqi|date=2020-06-27|title=Python Game projects with source code|url=https://coderslegacy.com/python-game-projects-with-source-code/|access-date=2020-12-25|website=CodersLegacy|language=en-US}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=http://pygame.org/docs/tut/chimp/ChimpLineByLine.html|title=Line by line tutorial - Tutorial for beginners|last=Shinners|first=Pete|url-status=dead|archive-url=https://web.archive.org/web/20050205015600/http://www.pygame.org/docs/tut/chimp/ChimpLineByLine.html|archive-date=5 February 2005}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=http://www.linuxjournal.com/article/7694|title=Creating Games with Python - A tutorial explaining how to use pygame for game development and improved execution|website=Linuxjournal.com}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|url=http://showmedo.com/videos/series?name=pythonArellanoPyGameSeries|title=Arinoid tutorials video tutorials at ShowMeDo|url-status=dead|archive-url=https://web.archive.org/web/20070429111639/http://showmedo.com/videos/series?name=pythonArellanoPyGameSeries|archive-date=29 April 2007}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sample code==&lt;br /&gt;
The following code makes an image of a raccoon(&amp;quot;raccoon.png&amp;quot;) bounce when hitting an edge.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import pygame, sys&lt;br /&gt;
&lt;br /&gt;
pygame.init()&lt;br /&gt;
screen = pygame.display.set_mode((1280, 720))&lt;br /&gt;
clock = pygame.time.Clock()&lt;br /&gt;
clock.tick(30)&lt;br /&gt;
black = 0, 0, 0&lt;br /&gt;
raccoon = pygame.image.load(&amp;quot;raccoon.png&amp;quot;)&lt;br /&gt;
raccoon = pygame.transform.scale(raccoon, (200, 140))&lt;br /&gt;
raccoonrect = raccoon.get_rect()&lt;br /&gt;
velocity = [1, 1]&lt;br /&gt;
&lt;br /&gt;
while True:&lt;br /&gt;
    raccoonrect = raccoonrect.move(velocity)&lt;br /&gt;
    if raccoonrect.left &amp;lt; 0 or raccoonrect.right &amp;gt; 1280:&lt;br /&gt;
        velocity[0] = -velocity[0]&lt;br /&gt;
        raccoon = pygame.transform.flip(raccoon, True, False)&lt;br /&gt;
    if raccoonrect.top &amp;lt; 0 or raccoonrect.bottom &amp;gt; 720:&lt;br /&gt;
        velocity[1] = -velocity[1]&lt;br /&gt;
    for event in pygame.event.get():&lt;br /&gt;
        if event.type == pygame.QUIT:&lt;br /&gt;
            sys.exit()&lt;br /&gt;
    # screen update&lt;br /&gt;
    screen.fill(black)&lt;br /&gt;
    screen.blit(raccoon, raccoonrect)&lt;br /&gt;
    pygame.display.flip()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Notable games using Pygame==&lt;br /&gt;
* &amp;#039;&amp;#039;[[Frets on Fire]]&amp;#039;&amp;#039;&amp;lt;ref&amp;gt;{{Cite web |title=fretsonfire/src at master · skyostil/fretsonfire |url=https://github.com/skyostil/fretsonfire |access-date=2023-06-02 |website=GitHub |language=en}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;[[Dangerous High School Girls in Trouble!]]&amp;#039;&amp;#039;&amp;lt;ref&amp;gt;{{cite web|title=Dangerous High School Girls in Trouble!|url=http://pygame.org/project-Dangerous+High+School+Girls+in+Trouble!-791-.html|website=Pygame.org|access-date=8 July 2011}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Portal|Free and open-source software|Video games}}&lt;br /&gt;
* [[Cocos2d]]&lt;br /&gt;
* [[Panda3D]]&lt;br /&gt;
* [[Pyglet]]&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
{{Notelist|refs=&lt;br /&gt;
{{Efn|name=fn1|Pygame 2 and later versions are based on SDL2, while earlier releases were based on SDL1.&amp;lt;ref&amp;gt;{{cite web|url=https://www.pygame.org/news/2019/3/1-9-5-released-into-the-wilds|title=pygame 1.9.5 released into the wilds|website=Pygame.org}}&amp;lt;/ref&amp;gt;}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist|30em}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* {{Official website}}&lt;br /&gt;
* [news://gmane.comp.python.pygame Pygame newsgroup] [https://web.archive.org/web/20070129083639/http://news.gmane.org/gmane.comp.python.pygame (web access)] - the &amp;quot;official&amp;quot;&lt;br /&gt;
* [http://pygame.renpy.org/ Pygame Subset for Android] (PGS4A)&lt;br /&gt;
* [https://pyopengl.sourceforge.net/ pyOpenGL] - Python OpenGL Bindings&lt;br /&gt;
* [https://pygame-sdl2.readthedocs.io/ Pygame-SDL2] - a reimplementation of Pygame APIs on top of SDL2&lt;br /&gt;
* [https://pysdl2.readthedocs.io/ PySDL2] - a wrapper around the SDL2 library similar to the discontinued PySDL project&lt;br /&gt;
&lt;br /&gt;
{{Video game engines}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Application programming interfaces]]&lt;br /&gt;
[[Category:Free computer libraries]]&lt;br /&gt;
[[Category:Free software programmed in Python]]&lt;br /&gt;
[[Category:Graphics libraries]]&lt;br /&gt;
[[Category:Linux APIs]]&lt;br /&gt;
[[Category:MacOS APIs]]&lt;br /&gt;
[[Category:Python (programming language) libraries]]&lt;br /&gt;
[[Category:Simple DirectMedia Layer]]&lt;br /&gt;
[[Category:Video game development software]]&lt;br /&gt;
[[Category:Video game development software for Linux]]&lt;br /&gt;
[[Category:Windows APIs]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Frap</name></author>
	</entry>
</feed>