Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language. Now, it’s up to the imagination or necessity of developer, what type of game he/she wants to develop using this toolkit.
Command to install pygame :
pip install pygame
There are four basic steps to displaying images on the
pygame window :
- Create a display surface object using
display.set_mode()method of pygame.
- Completely fill the surface object with white using
fill()method of pygame display surface object.
- Drawing different shapes onto a surface object using
Primitive Drawing Functionsof pygame.
- Show the display surface object on the pygame window using
display.update()method of pygame.
Below is the implementation:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python - Drawing design using arrow keys in PyGame
- Python | Display text to PyGame window
- Python Tkinter | Create different shapes using Canvas class
- Calculating Areas Of Different Shapes Using Python
- How to get bounding-box of different Shapes in p5.js ?
- Pycairo - Creating different shapes
- PYGLET – Drawing Mouse Cursor for Window
- PyCairo - Drawing different type of line caps
- PyCairo - Drawing different type of line Joins
- PyCairo - Drawing different Pen dashes
- Draw Color Filled Shapes in Turtle - Python
- How to Create custom Turtle shapes in Python?
- Draw geometric shapes on images using OpenCV
- Class 8 RD Sharma Solutions - Chapter 15 Understanding Shapes Polygons - Exercise 15.1
- Python | Display images with PyGame
- Python | Making an object jump in PyGame
- Python | Playing audio file in Pygame
- Python - Moving an object in PyGame
- Tic Tac Toe GUI In Python using PyGame
- Binary Search Visualization using Pygame in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.