【问题标题】:Pygame on mac error with loading images加载图像时出现 Mac 上的 Pygame 错误
【发布时间】: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


【解决方案1】:

您在该版本的 OS X 上看到 SDL_image 中的一个已知错误。有关详细信息和解决方法,请参阅此链接:

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

【讨论】:

    猜你喜欢
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-05
    相关资源
    最近更新 更多