I am currently on a pygame project and wanted to display some text. I have done this before in another program and it works just fine but when I write the exact same thing in this project, it gives this error :
Traceback (most recent call last):
File "C:UsersFazelifarDesktopDot Game.py", line 197, in <module>
myfont = pygame.font.SysFont(None, 15)
File "C:UsersFazelifarAppDataLocalProgramsPythonPython37-32libsite-packagespygamesysfont.py", line 362, in SysFont
return constructor(fontname, size, set_bold, set_italic)
File "C:UsersFazelifarAppDataLocalProgramsPythonPython37-32libsite-packagespygamesysfont.py", line 285, in font_constructor
font = pygame.font.Font(fontpath, size)
pygame.error: font not initialized
and here is my code :
myfont = pygame.font.SysFont(None, 15)
def txt_display (txt , color , x , y):
txt = lala.render(txt , True , black)
main.blit(txt , (x , y))
plz help I am stuck
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…