简体   繁体   English

Mac上的Pygame在加载图像时出错

[英]Pygame on mac error with loading images

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 我最近开始在pygame上进行编程,我使用python 3.5.1和最新的pygame,当我加载位图(bmp)时,它会像这样显示在屏幕上

在此处输入图片说明

At school when I program on the computer it works fine just on my macbook pro 13'' with el capitain 在学校里,当我在计算机上编程时,仅在我的El Capitain Macbook Pro 13''上运行良好

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: 您正在该版本的OS X上的SDL_image中看到一个已知的错误。有关详细信息和解决方法,请参见此链接:

https://bitbucket.org/pygame/pygame/issues/284/max-osx-el-capitan-using-the-deprecated https://bitbucket.org/pygame/pygame/issues/284/max-osx-el-capitan-using-the-deprecated

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM