def _update_high_score_list(self): high_score_rect = pygame.Rect(0, 0, config.screen_width // 3, self.high_score_rect.height) high_score_rect.top = config.screen_height // 8 high_score_rect.centerx = config.screen_width // 2 self.score_group.empty() # pad score list out to 10, if necessary padded_list = [ _Score("???", -1) for _ in range(10 - len(self.high_scores)) ] self.high_scores += padded_list score_counter = 1 rect = None for score in self.high_scores: image = self._render_high_score(config.screen_width // 2, score_counter, score) rect = rect or image.get_rect() rect.top = high_score_rect.bottom + 10 + (score_counter - 1) * (rect.height + 6) sprite = StaticAnimation(image) sprite.rect = rect.copy() sprite.rect.centerx = config.screen_rect.centerx self.score_group.add(sprite) score_counter += 1