【发布时间】:2018-01-05 20:01:22
【问题描述】:
我正在为我的 pygame 制作一个帮助屏幕,但每次运行它时都会收到此错误消息:
> self.surface.blit(self.helpscreen) TypeError: argument 1 must be > pygame.Surface, not pygame.Rect
我不知道如何解决它,而且我还在学习 pygame,所以如果可能的话,我需要一个非常基本的答案。我的代码如下:
def help(self):
pygame.init()
self.FPS = 60
self.fps_clock = pygame.time.Clock()
self.surface = pygame.display.set_mode((640, 480))
helpscreen = DISPLAY_SURF.fill(white)
self.surface.blit(helpscreen)
# This class sets the basic attributes for the window.
# The clock is set to 60 and the name of the window
# is set to The Hunt which is a working title for my project
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
while True:
pygame.display.update()
self.fps_clock.tick(self.FPS)
self.process_game()
【问题讨论】:
-
你的
helpscreen是一个rect但 blit 需要一个surface对象 -
我该如何解决?我需要更改代码的哪一部分以及如何更改?