Python | Drawing different shapes on PyGame window
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: