Can't build games with pygame

I am making a game with python 2.5 and pygame.

but I cannot complete make. because these errors have occurred.

C:\Python26\TypeType\src\dist\Main.exe:8: RuntimeWarning: use font: MemoryLoadLibrary failed loading pygame\font.pyd
Traceback (most recent call last):
  File "Main.py", line 8, in <module>
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: font module not available
Traceback (most recent call last):
  File "Main.py", line 8, in <module>
  File "pygame\sysfont.pyo", line 253, in SysFont
RuntimeError: default font not found 'freesansbold.ttf'

      

Perhaps I think the reason is that it was using an object called sysfont. (Because I had programs that didn't use sysfont in the run file and could run from a PC that didn't have Python installed) What's wrong. sorry i'm starting.

EDIT I can find Python2.5 \ Lib \ site-packages \ pygame \ freesansbold.ttf

but the same error occured .. Where can I copy freesansbold.ttf

0


a source to share


3 answers


A simple solution is to just download the font directly and not use sysfont. Just use the pygame.font.Font class and load the ttf file right away. It will also make py2exe easier to use and you can choose exactly the font you want.



+2


a source


It looks like you don't have a file freesansbold.ttf

on your computer in the available fonts folder. This font should have been shipped with Pygame in a directory lib

.



Check the install folder for your copy of Pygame, and if it's there, change your Python install font path to include that directory. If not, you need to find a copy or download a new version of Pygame.

+1


a source


You probably found a solution, but I want to give it to someone else. Create a game with pygame. Then unzip the librairy. Go to

PythonX.X \ Lib \ site-packages \ pygame and copy freesansbold.ttf

Go back to the library file you unzipped and navigated to

Library \ Pygame

Place the freesansbold.ttf and zip library.

Now it works! :)

0


a source







All Articles