pygame font issue

Irv Kalb Irv at furrypants.com
Sat Mar 13 17:33:47 EST 2021


You need to initialize the font system with this line before you attempt to load a font:

        pygame.font.init()

Irv

> On Mar 13, 2021, at 8:11 AM, MRAB <python at mrabarnett.plus.com> wrote:
> 
> On 2021-03-13 15:20, Quentin Bock wrote:
>> Code that contains the problem:
>> score_value = 0
>> font = pygame.font.SysFont('freesansbold.ttf', 32)
>> error:
>> in font_constructor  font = Font(fontpath, size)
>> pygame.error: font not initialized
>> Can someone explain why it's saying font not initialized and provide a
>> solution?
>> I have tried typing in the direct file path of the font but that didn't
>> work, nor did using SysFont
> In your previous post you said that your code was "almost identical" to what was in the tutorial, so the problem is probably in the difference. You haven't provided enough detail (code) for any of us to identify the problem.
> -- 
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list