Search results
Results from the WOW.Com Content Network
For more in depth reference, check out the Tutorials section below, check out a video tutorial (I'm a fan of this one), or reference the API documentation by module. 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.
The pygame package represents the top-level package for others to use. Pygame itself is broken into many submodules, but this does not affect programs that use pygame. As a convenience, most of the top-level variables in pygame have been placed inside a module named pygame.locals pygame constants.
See the pygame.gfxdraw pygame module for drawing shapes module for alternative draw methods.
The pygame website has full reference documentation for every pygame function and tutorials for all ranges of users. The pygame source comes with many examples of things like monkey punching and UFO shooting.
Compiling and installing pygame is handled by Python's distutils. Pygame also comes with some scripts to automatically configure the flags needed to build pygame. Use the "setup.py" script to start the installation. The first time you run the setup script, it will call the "config.py" script.
This module offers control over the pygame display. Pygame has a single display Surface that is either contained in a window or runs full screen. Once you create the display you treat it as a regular Surface. Changes are not immediately visible onscreen; you must choose one of the two flipping functions to update the actual display.
These constants are defined by SDL, and needed in pygame. Note that many of the flags for SDL are not needed in pygame, and are not included here. These constants are generally accessed from the pygame.locals module. This module is automatically placed in the pygame namespace, but you
David Clark is an avid pygame user and the editor of the Pygame Code Repository, a showcase for community-submitted python game code. He is also the author of Twitch, an entirely average pygame arcade game. This guide was substantially updated in 2022.
By the end of the tutorial, you should not only have a firmer grasp of pygame, but you should also understand how TomPong works, and how to make your own version. Now, for a brief recap of the basics of pygame.
See the pygame.image.frombuffer() create a new Surface that shares data inside a bytes buffer method for a potentially faster way to transfer images into pygame.