Answers for "how to get display size in pygame"

2

pygame get screen width and height

#pygame
w, h = pygame.display.get_surface().get_size()

#w = width
#h = height
Posted by: Guest on April-30-2021
0

pygame size of image

image = pygame.image.load("path/to/file.png")  # load image

width, height = image.get_width(), image.get_height()  # get size
print(width, height)  # print size

"""
OUTPUT:
(50, 50)
"""
Posted by: Guest on January-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language