SVG images do not appear after compiling pion PyQt4 code with py2exe

I wrote a python application using svg images as icons.

QtGui.QIcon(':icons/icon.svg') <- just like this 

It works on my computer, but after compiling it with py2exe and running on another computer, there are no icons. if I try, for example. bmp, everything is working fine. so I think this might be a library issue. I do not know what PyQt4 uses svg for graphics.

in the setup.py file that I wrote

 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" ]}}) 

as well as a folder with samples (with qvg4.dll, etc.) included in the myApp.exe directory

so how to solve this problem?

thanks Jarek

+4
source share
3 answers

Used plugin (Qt 4.6):

  • plugins /
    • iconengines /
      • qsvgicon4.dll

You still need qt.conf, as Ivo explained.

+3
source

You need to add qt.conf to the main installation directory of the application (in fact, the working directory of the application), containing:

 [Paths] Plugins = <directory containing the image plugins directory> 

So, the catalog layout:

  • app.exe
  • qt.conf
  • plugins /
    • imageformats /
      • qsvg4.dll

And then in this case the directory in qt.conf is plugins .

+2
source

The qsvg plugin requires QtXml . Add "PyQt4.QtXml" to your included ones.

Also see library dependencies in Qt .

0
source

All Articles