import pygame
from sys import exit
pygame.init()
screen = pygame.display.set_mode((600,170),0,32)
pygame.display.set_caption("Hello World!") //set caption
background = pygame.image.load('bg.jpeg').convert //load picture and convert it
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
screen.blit(background,(0,0))
pygame.display.update() //refresh
我得到的错误:pygame的无法继续成功
File "/Users/huangweijun/PycharmProjects/untitled1/first.py", line 12, in<module>
screen.blit(background,(0,0))
TypeError: argument 1 must be pygame.Surface, not builtin_function_or_method
我有下载pygame的
我不知道如何解决这个问题。
你可以只用'背景= pygame.image.load( “bg.jpeg”)'代替'背景= pygame.image.load( 'bg.jpeg')试试。convert' –
谢谢你。问题解决了 –
所以这基本上意味着你不必转换图像 –