【问题标题】:Font module error when using pygame2exe使用 pygame2exe 时出现字体模块错误
【发布时间】:2011-09-16 14:23:17
【问题描述】:

我使用了 Pygame 网站上的 Pygame2exe 并解决了 .dlls 的问题,但仍然存在错误。
我使用的唯一字体是标准的 pygame 字体 (freesansbold.ttf),我在我的游戏目录中包含了它的副本。
另外,
我使用的是 Font 类,而不是我认为可以解决我的问题的 SysFonts 类。
有什么想法吗?

C:\Python26\apple_orchard\dist\appleorchard.exe:27: RuntimeWarning: use font: MemoryLoadLibrary failed loading pygame\font.pyd
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
Traceback (most recent call last):
  File "appleorchard.py", line 165, in <module>
  File "appleorchard.py", line 27, in __init__
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: font module not available
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)

【问题讨论】:

    标签: python pygame py2exe


    【解决方案1】:

    你的问题看起来和这个很相似:http://thadeusb.com/weblog/2009/4/15/pygame_font_and_py2exe

    尝试将"sdl_ttf.dll" 添加到系统 dll 列表中,如下所示:

    origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
    def isSystemDLL(pathname):
        # checks if the freetype and ogg dll files are being included
        if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll"):
                return 0
        return origIsSystemDLL(pathname) # return the orginal function
    py2exe.build_exe.isSystemDLL = isSystemDLL # override the default function with this one
    

    【讨论】:

    • 谢谢!我自己是不可能想出来的! :P
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-27
    • 2020-11-22
    • 2014-10-22
    • 2019-04-13
    相关资源
    最近更新 更多