【发布时间】:2010-08-08 15:19:03
【问题描述】:
我使用 svg 图像作为图标编写了 python 应用程序。
QtGui.QIcon(':icons/icon.svg') <- just like this
它可以在我的通勤机上运行,但是用 py2exe 编译并在另一台计算机上运行后,没有图标。 如果我尝试例如bmp 格式,一切正常。所以我认为这可能是一些图书馆问题。 我不知道 PyQt4 用于 svg 图形的什么。
在我写的 setup.py 文件中
dllList = ('mfc90.dll','msvcp90.dll','qtnetwork.pyd','qtxmlpatterns4.dll', 'qsvg4.dll', 'qsvgd4.dll')
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in dllList:
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
setup(windows=[{"script" : "myApp.py"}], options={"py2exe" : {"includes" : ["sip", "PyQt4.QtNetwork", "PyQt4.QtWebKit", "PyQt4.QtSvg" ]}})
myApp.exe 目录中还包含 imageformats 文件夹(带有 qvg4.dll 等)
那么如何解决这个问题呢?
谢谢, 贾雷克
【问题讨论】: