[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] py2exe and fonts



> > I've tried to freeze several pygame examples
> > with py2exe and always get the following error:
> > 
> > C:\sf\py2exe\tests\pygame-examples\dist\aliens>aliens
> > Traceback (most recent call last):
> >   File "<string>", line 432, in ?
> >   File "<string>", line 404, in main
> > RuntimeError: Couldn't load font file
> > 
> > What is missing?

I got something similar myself.. and I don't know the cause for this error,
but I've found a work-around:
do NOT call pygame.font.Font(None,x). This won't work with py2exe. Instead
specifiy a font file and copy this file into the necessary folders. You can
take bluebold.ttf from SolarWolf or YaSS f.ex.
Then change your code to look like this: pygame.font.Font('bluebold.ttf',x)
of course you can use any other font file as well.

And don't forget to change your pygame2exe.py file. The one from pygame.org
comes with the following content:
---
#also need to hand copy the default font here
import pygame.font, os, shutil
src = os.path.split(pygame.font.__file__)[0] + '\\bluebold.ttf'
dst = os.path.join('dist', project_name, 'bluebold.ttf')
---
I also experienced a problem with that font destination.. somehow py2exe didn't
manage to copy the font file in there and came up with an error message. It
worked when copying the font file into the 'dist' folder manually tho.

hth
-- 
Raiser, Frank aka CrashChaos
IRC: 141.30.225.9:6667 #United-Programmers

"A mathematician is a blind man in a dark room looking for a black cat 
which isn't there."                -- Charles Darwin
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org