[Tutor] (no subject)

Danny Yoo dyoo at hashcollision.org
Sat Nov 29 21:26:16 CET 2014


> When I run the code using the IDLE the Python shell gives me the following
> error
>
> Traceback (most recent call last):
> File "/home/william/Desktop/Pygame/Python 3X/Drawing_Shapes.py", line 48, in
> <module>
> font = pygame.font.SysFont('Calibri', 25, True, False)
> File "/usr/local/lib/python3.4/dist-packages/pygame/sysfont.py", line 614,
> in SysFont
> return constructor(fontname, size, set_bold, set_italic)
> File "/usr/local/lib/python3.4/dist-packages/pygame/sysfont.py", line 537,
> in font_constructor
> font = pygame.font.Font(fontpath, size)
> pygame.error: font not initialized


Hi William,

Please check with the pygame folks on this one; pygame is a
third-party library, and we at Tutor might not be too familiar with
the library.  There should be an active pygame-users mailing list at
the following URL:

    http://www.pygame.org/wiki/info

According to web searches, the term "pygame.error: font not
initialized" means that you may have forgotten to initialize PyGame
first.

Reference: http://inventwithpython.com/pygame/chapter2.html, where
they say: "If you ever see an error message like pygame.error: font
not initialized, check to see if you forgot to call pygame.init() at
the start of your program."


Again, I have no direct experience with PyGame, so I can not confirm
that this will fix the issue for your own program.  This is why you'll
probably want to ask on pygame-users.


Good luck to you!


More information about the Tutor mailing list