[PyQt] Looking for docs of packing PyQt4 app with py2exe

Frédéric frederic.mantegazza at gbiloba.org
Thu Feb 12 08:34:33 GMT 2009


Le 12/2/2009, "Frédéric" <frederic.mantegazza at gbiloba.org> a écrit:

>> I am aware of [1] but I am not clear on how treats resources like
>> images. I currently have them in the simplest/laziest form -- images
>> are directly on the filesystem and linked to from within Qt Designer.
>> So I was hoping for someone to point me to docs on including them
>> properly in a Qt resource file (and changing my Python code
>> accordingly) and how this will be affected by py2exe
>
>Once you resource file is compiled as a python file, using pyrcc4, you will
>import it in your app as any other module, so it will be automatically
>included in the py2exe build process...

Sorry, I was not clear enough... In Designer, you just build resources,
including the images you need. Then, you use the images from the
resources, instead of the files, in your widgets.

Then, use pyrcc4 to compile these resources (.qrc) as a python module
(.py).

Finally, in your code, just use:

from myResources import qInitResources, qCleanupResources
# Init
qInitResources()
# Code
...
# Cleanup
qCleanupResources()

Hope this helps.

--
   Frédéric



More information about the PyQt mailing list