[Pythonmac-SIG] Including images (jpg) in app bundle

Brendan Simon (eTRIX) Brendan.Simon at eTRIX.com.au
Sat Aug 8 15:13:42 CEST 2009


I have a jpg image which is displayed in my wxPython app.  It is loaded
from an 'image' directory.
eg. image/mypic.jpg

This works fine when I type "python mywxapp" from the command line, but
when I build an app bundle it doesn't work.
I've tried two options (see below).  Both copy the jpg to the Resourses
directory, but I loose the images/ directory.

What's the best/appropriate way to get image files in the app ??  It has
to work with manual invocation too.
Put image files in the same directory as the source ???

Thanks, Brendan.

    DATA_FILES = [ 'images/mypic.jpg' ]

    OPTIONS = {
                'argv_emulation' : True,
               }

    setup(
        app = APP,
        data_files = DATA_FILES,
        options = { 'py2app' : OPTIONS },
        setup_requires=['py2app'],
    )


and:

    DATA_FILES = []

    OPTIONS = {
                'argv_emulation' : True,
                'resources' : 'images/mypic.jpg',
               }

    setup(
        app = APP,
        data_files = DATA_FILES,
        options = { 'py2app' : OPTIONS },
        setup_requires=['py2app'],
    )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Brendan_Simon.vcf
Type: text/x-vcard
Size: 267 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090808/feb6145c/attachment.vcf>


More information about the Pythonmac-SIG mailing list