AttributeError: 模块 'pygame.font' 没有属性 'Sysfont',

问题描述

我刚开始使用 Python,我想通过教程来学习它,https://www.youtube.com/watch?v=Q-__8Xw9KTM

我正在逐步按照教程进行操作,但是,这表明我遇到了问题。尽管我一字不差

有人可以帮我吗?

This is the part This is the tutorial's

注意:我包含了 pygame.font.init()

解决方法

这是一个错字。 Python 区分大小写。 Sysfont 必须是 SysFont

main_font = pygame.font.Sysfont("comicsans",50)

main_font = pygame.font.SysFont("comicsans",50) 

lost_font = pygame.font.Sysfont("comicsans",60)

lost_font = pygame.font.SysFont("comicsans",60)