Learn Before
Code
Scale a Surface in Pygame
You can use transform.scale() to scale a surface up or down to a certain size. You pass in the surface you want to scale, the size you want to scale it to, and an optional destination surface to set it to in case you don't want the function to return a new surface. The destination surface must be the same size as the final size for your scaled surface, however.
smallSurface = pygame.surface(20, 20) bigSurface = pygame.transform.scale(smallSurface, (100, 100)) #scales smallSurface up to (100, 100) and stores it in bigSurface giantSurface = pygame.surface(200, 200) pygame.transform.scale(bigSurface, (200, 200), giantSurface) #scales bigSurface up to (200, 200) and stores it in giantSurface
0
1
Updated 2021-08-09
Tags
Python Programming Language
Data Science