我从 youtbe 视频中编码了这个,他似乎做得很好,但当我尝试时,我在底部收到错误消息,我很困惑,我需要帮助。
#!/usr/bin/env python
import pygame, sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((370, 572), 0, 32)
backgroundfile = "back.png"
mousefile = "mouse.png"
back = pygame.image.load(backgroundfile).convert()
mouse = pygame.image.load(mousefile).convert_alpha()
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
#Now we have initialized everything lets start with the main part
screen.blit("back.png", (0,0))
pygame.display.flip()
Run Code Online (Sandbox Code Playgroud)
当我运行该程序时,我收到错误:
Traceback (most recent call last):
File "Tutorial 5 First game.py", line 26, in <module>
screen.blit("back.png", (0,0))
TypeError: argument 1 must be pygame.Surface, …Run Code Online (Sandbox Code Playgroud)