【发布时间】:2016-01-08 02:04:14
【问题描述】:
我最近开始在 pygame 上编程,我使用 python 3.5.1 和最新的 pygame,当我加载位图(bmp)时,它会像这样将它放在屏幕上
在学校,当我在电脑上编程时,它在我的 macbook pro 13'' 和 el capitain 上运行良好
import pygame #imports pygame
width = 550 #width is 550
height = 420 #height is 420
size = width, height # size is a tuple
screen = pygame.display.set_mode(size)
white = 255,225,255
screen.fill(white)
gameOn = True
mario = pygame.image.load("mario.bmp") #load the bitmap
marioflip = pygame.transform.flip(mario, True, True)
screen.blit(marioflip, (0,0)) # add it to screen
marioscale = pygame.transform.scale(mario, (50,50))
screen.blit(marioscale, (250,250))
mariorotate = pygame.transform.rotate(mario, 45)
screen.blit(mariorotate,(350,0))
while gameOn:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
pygame.display.flip()
【问题讨论】:
-
@furas 我已经试过它不起作用
标签: python image macos bitmap pygame