How to make Pygame window in full size
Here in this tutorial, we will learn how to make a full-size window using Pygame which is a Python library used for building games with a very good graphical user interface.
Making a full-size window
First of all, we will download and import the pygame library which we will use for :
- Making the game screen
- Setting its dimensions
- Exiting the screen when done
- Updating all the changes made
import pygame screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN) while True: for i in pygame.event.get(): if i.type == pygame.QUIT: pygame.quit() exit() pygame.display.update()
For making a full-size window we will simply use the pygame.FULLSCREEN function with initial dimensions set to zero.
Then using the while loop we will perform desired operations in the game and when we need to exit the screen/game we will use pygame.QUIT and pygame.quit() function to do so.
We also need to exit the while loop which will happen using the exit() function.
In the end, we will use the display.update() function the finally update the screen/game with all the changes made.
Thus we have created a full-size screen using Pygame in Python.