Last Updated : 23 Jul, 2025
In this article, we will learn How to allow resizing a PyGame Window.
Game programming is very rewarding nowadays and it can also be used in advertising and as a teaching tool too. Game development includes mathematics, logic, physics, AI, and much more and it can be amazingly fun. In python, game programming is done in pygame and it is one of the best modules for doing so.
Installation:
This library can be installed using the below command:
pip install pygameNormal PyGame Window
Steps-by-step Approach:
Below is the program based on the above approach:
Python3
# import package pygame
import pygame
# Form screen with 400x400 size
# with not resizable
screen = pygame.display.set_mode((400, 400))
# set title
pygame.display.set_caption('Not resizable')
# run window
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# quit pygame after closing window
pygame.quit()
Output :
Resizable PyGame WindowStep-by-step Approach:
Below is the program based on the above approach:
Python3
# import package pygame
import pygame
# Form screen with 400x400 size
# and with resizable
screen = pygame.display.set_mode((400, 400),
pygame.RESIZABLE)
# set title
pygame.display.set_caption('Resizable')
# run window
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# quit pygame after closing window
pygame.quit()
Output :
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4