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 upto the imagination or necessity of developer, what type of game he/she want to develop using this toolkit.
Command to install pygame on windows based system :
pip install pygame
There are 7-basic steps to displaying Text on the
pygame window :
- Create a display surface object using
display.set_mode()method of pygame.
- Create a Font object using
fony.Font()method of pygame.
- Create a Text surface object i.e.surface object in which Text is drawn on it, using
render()method of pygame font object.
- Create a rectangular object for the text surface object using
get_rect()method of pygame text surface object.
- Set the position of the Rectangular object by setting the value of the
centerproperty of pygame rectangular object.
- Copying the Text surface object to the display surface object using
blit()method of pygame display surface object.
- Show the display surface object on the pygame window using
display.update()method of pygame.
Below is the implementation:
- Python | Display images with PyGame
- Python | Drawing different shapes on PyGame window
- wxPython - Add text in window
- Tic Tac Toe GUI In Python using PyGame
- Python - Moving an object in PyGame
- Set Window Icon Text in PyQt5 | setWindowIconText() method
- Python | Playing audio file in Pygame
- Python | Making an object jump in PyGame
- Python - Drawing design using arrow keys in PyGame
- Convert Text and Text File to PDF using Python
- Display Hostname and IP address in Python
- Python | Count and display vowels in a string
- 8-bit game using pygame
- Introduction to pygame
- Display date and time in videos using OpenCV - Python
- How to add color breezing effect using pygame?
- Bubble sort visualizer using PyGame
- How to create Buttons in a game using PyGame?
- How to initialize all the imported modules in PyGame?
- Change Object Display Name using __str__ function - Django Models | 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 firstname.lastname@example.org. 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.