Python usig pygame中的错误(AttributeError:“ builtin_function_or_method”对象没有属性“ right”)

我一直在按照我购买的书(2019年版)的说明使用python制作游戏,但是经过大约300-400行代码后,我的游戏遇到了错误,这对我一生来说都是无法修复的。错误如下:“ AttributeError:'builtin_function_or_method'对象没有属性'right'”。错误代码如下:

def prep_score(self):

    """Turn the score into a rendered image."""
    score_str = str(self.stats.score)
    self.score_image= self.font.render(score_str, True,
        self.text_color, self.settings.bg_color)

    # Display the score at the top right of the screen.
    self.score_rect = self.score_image.get_rect()
    self.score_rect.right = self.screen_rect.right - 20  <----- error line
    self.score_rect.top = 20

我已经将它与本书进行了大约一个小时的比较,当我只运行该模块(scoreboard.py)时,似乎没有任何错误,但是随后运行了游戏模块(alien_invasion.py),我明白了终端错误。作者也有一个资源包,其中包含本章中的确切代码,当我运行该代码时,它可以正常工作,但是我的版本却不行,这没有意义,因为模块“ scoreboard.py”是相同的,但是“ alien_invasion.py”模块是不同的,但是由于它具有部分代码,这些部分将在本书的后面出现,所以我不知道什么是有区别的代码。

这是包含此内容的Alien_invasion.py代码:

from scoreboard import Scoreboard
(...)

def __init__(self):

    pygame.init()
    self.settings = Settings()

    self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
    self.settings.screen_width = self.screen.get_rect().width
    self.settings.screen_height = self.screen.get_rect().height
    pygame.display.set_caption("Alien Invasion")

    # Create an instance to store game statistics.
    self.stats = GameStats(self)

    self.ship = Ship(self)
    self.bullets = pygame.sprite.Group()
    self.aliens = pygame.sprite.Group()

    self._create_fleet()

    # Make the Play button.
    self.play_button = Button(self, "Play")
    self.sb = Scoreboard(self)

(...)

def _update_screen(self):


    # Redraw the screen during each pass through the loop.
    self.screen.fill(self.settings.bg_color)
    self.ship.blitme()
    for bullet in self.bullets.sprites():
        bullet.draw_bullet()
    self.aliens.draw(self.screen)

    # Draw the score information.
    self.sb.show_score()    

    # Draw the play button if the game is inactive.
    if not self.stats.game_active:
        self.play_button.draw_button()

    # Make the most recently drawn screen visible
    pygame.display.flip()

两者之间有更多代码,但这是唯一实际涉及到此的代码。

谢谢,如果可以的话,请尝试给我一些有关他的提示,我真的很绝望(第一次在论坛中)。