【发布时间】:2014-08-06 22:30:35
【问题描述】:
我目前正在使用 python 3.2.3 和 pygame 为我的游戏渲染字体。我目前收到错误:
Traceback (most recent call last):
File "E:\FinalProject.py", line 249, in <module>
drawLevel1(screen, guy)
File "E:\FinalProject.py", line 107, in drawLevel1
text = font.render("Level : %s" % (lvlNum), 1, (0,0,0))
AttributeError: 'module' object has no attribute 'render'
使用以下代码:
pygame.font.init()
pygame.font.SysFont("Grobold", 20)
if lvlNum == level1 or lvlNum == level2 or lvlNum == level3:
text = font.render("Level : %s" % (lvlNum), 1, (0,0,0))
我不知道为什么会出现这个错误。对此错误的任何帮助表示赞赏。
【问题讨论】:
标签: python fonts pygame render