pygame的与加载图像的MAC错误 [英] Pygame on mac error with loading images
问题描述
我最近在pygame的开始编程,我使用Python 3.5.1和最新的pygame的,当我打开一个位图(BMP),它把它像这样的屏幕
在在学校的时候我编程的计算机上正常工作只是我的MacBook Pro 13''带EL capitain
进口pygame的#imports pygame的宽度= 550 #width 550高度= 420 #height为420大小=宽,高尺寸#是一个元组屏幕= pygame.display.set_mode(大小)白= 255225255screen.fill(白色)gameOn = TRUE马里奥= pygame.image.load(mario.bmp)#load位图marioflip = pygame.transform.flip(马里奥,真,真)screen.blit(marioflip,(0,0))#把它添加到屏幕marioscale = pygame.transform.scale(马里奥,(50,50))screen.blit(marioscale,(250,250))mariorotate = pygame.transform.rotate(马里奥,45)screen.blit(mariorotate,(350,0))而gameOn: 在pygame.event.get事件(): 如果event.type == pygame.QUIT: pygame.quit() pygame.display.flip()
您看到在SDL_image该版本OS X的一个已知的bug见这个链接细节上的解决方法:
的https://bitbucket.org/pygame/pygame/issues/284/max-osx-el-capitan-using-the-de$p$pcated
I recently started programming on pygame, I use python 3.5.1 and the latest pygame and when I load a bitmap(bmp) it puts it on the screen like this
At school when I program on the computer it works fine just on my macbook pro 13'' with 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()
You are seeing a known bug in SDL_image on that version of OS X. See this link for details and a workaround:
https://bitbucket.org/pygame/pygame/issues/284/max-osx-el-capitan-using-the-deprecated
这篇关于pygame的与加载图像的MAC错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!