2013-07-23 52 views
1

嗨,經過很多研究,我無法找到答案。Pygame.error:文件不是一個WINDOWS BMP文件(mac osx)

運行mac osx 10.8.4 python 2.7.5和pygame 1.9.2。

所有模塊在pygame中的積累被發現並重新安裝犯規解決問題 運行時:

import pygame 
import math 
import random 

black = (0,0,0) 
red = (255,0,0) 
white = (255,255,255) 
blue = (0,0,255) 
green = (0,255,0) 

pygame.init() 

print pygame.image.get_extended() 
size = (1000,700) 
screen = pygame.display .set_mode(size) 

pygame.display.set_caption("My game") 

done = False 

clock = pygame.time.Clock() 

background_image = pygame.image.load("red_x.png").convert() 

while done == False: 
    # ALL EVENT PROCESSING SHOULD GO BELOW THIS COMMENT 
    for event in pygame.event.get(): 
     if event.type == pygame.QUIT: 
      done = True 


    # ALL EVENT PROCESSING SHOULD GO ABOVE THIS COMMENT 


    # ALL GAME LOGIC SHOULD GO BELOW THIS COMMENT 

    # ALL GAME LOGIC SHOULD GO ABOVE THIS COMMENT 


    # ALL CODE TO DRAW SHOULD GO BELOW THIS COMMENT 
    screen.fill(black) 

    screen.blit(background_image,[0,0]) 
    # ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT 
    pygame.display.flip() 

    clock.tick(20) 

pygame.quit() 

我得到一個文件是不是有效的Windows BMP錯誤。 pygame.images.get_extended()返回0

try: 
    import SDL_image 
    print "Loaded SDL_image" 
except: 
    print "Failed to import SDL_image" 

try: 
    import libpng 
    print "Loaded libpng" 
except: 
    print "Failed to import libpng" 

同時返回導入失敗的消息。我認爲在搜索這個和他們的所有解決方案時我看到的所有測試都無效。

回答