[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?

hello thomas. pygame programs can request a 'default font'
by not specifying a path to the file. in that case the
"font.pyd" module tries to load the "bluebold.ttf" font
from the same directory as the font.pyd.

now how the module finds its own directory involves a little
bit of mojo. it mainly just requires that "bluebold.ttf" lives
in the same directory as "font.pyd". (actually, now that a look
over the code, it needs to be in the same directory as 
"pygame.__init__", which can get ugly when it is inside an exe)

a whole new idea just hit me, and it is all around better.
i've checked it into cvs, and it should always find the default
font when it is in the same directory as "font.pyd". (or
"font.so" if that is your case :] )

also, in the "all else fails" category, this new version will
at least look for the default font in the current directory.
which may help appease the case for standalones?


thomas, this should work a lot better for you. as long as
the bluebold.ttf is in the same directory as your font module,
it should run, even in a standalone configuration.
you can either update from cvs (instructions are here,
http://www.pygame.org/info.shtml#cvs). or you can download the
latest cvs snapshot, which is here,
http://www.pygame.org/ftp/pygame-cvs.tar.gz


this should do a lot better for you. if not let me know, it
shouldn't be hard from here.


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org