我正在尝试在pygame中调整图像大小。我希望我的背景图像能够填满整个屏幕。我想根据背景的新(拉伸)尺寸设置整个屏幕。以下是行不通的,我试图找出原因。
建议?
background = pygame.image.load("data/stars.bmp")
pygame.transform.scale(background, (1200,800)) #or some size x,y here.
bgRect = background.get_rect()
size = width, height = bgRect.width, bgRect.height
screen = pygame.display.set_mode(size)
screen.blit(background, bgRect)
pygame.display.flip()
答案 0 :(得分:7)
#pygame.transform.scale(background, (1200,800)) #or some size x,y here.
background = pygame.transform.scale(background, (1200,800))