I have an Eclipse Project that uses a variety of Images (Toolbar
Buttons, Menu Icons, Program Icons, List Icons, etc). Initially I was
using things like wx.Bitmap to load the image files directly. After
compiling to executable with Py2Exe I encountered a number of problems
related to relative paths - images could not be located.
Following the steps out lined here: http://www.daniweb.com/forums/thread255458.html
I was able to overcome some of the relative path problems, but the
necessary changes to my code convoluted it further than I wanted, so I
opted to investigate the Img2Py alternatives.
Using Img2Py I was able to create a resource folder that contains the
necessary images stored as .py files. When I launch my application
from Eclipse in either Debug or Run mode, everything works
beautifully. When I compile my program to an executable using Py2Exe
most of my images do not display - Enabled Toolbar Images are present,
but Disabled Toolbar Images are missing. List Item Images do not
display.
I've reviewed the contents of the library.bin file created with Py2Exe
and the resource folder that contains my images is present and
intact. I don't receive any kind of stack traces to investigate and
the program appears to function properly, though the display is hokey
without the images in place. I don't know that a standalone
demonstration will be feasible, but I'm working on trying to create
something that demonstrates the issue.
Any advise or suggestions are much appreciated. Thanks in advance,
--Dan
It should be working if all the image .py files have been included in the exe bundle... Are you sure that you've embedded all images into the .py files? Perhaps there are still some images that are being loaded from their original image files. You could try temporarily removing the image files from your dev workspace and try running again without py2exe-ing it and see if you get any errors that way.
···
On 11/5/10 11:21 AM, g.d.d.c wrote:
I have an Eclipse Project that uses a variety of Images (Toolbar
Buttons, Menu Icons, Program Icons, List Icons, etc). Initially I was
using things like wx.Bitmap to load the image files directly. After
compiling to executable with Py2Exe I encountered a number of problems
related to relative paths - images could not be located.
Following the steps out lined here: My experiences building a small app with ... [SOLVED] | DaniWeb
I was able to overcome some of the relative path problems, but the
necessary changes to my code convoluted it further than I wanted, so I
opted to investigate the Img2Py alternatives.
Using Img2Py I was able to create a resource folder that contains the
necessary images stored as .py files. When I launch my application
from Eclipse in either Debug or Run mode, everything works
beautifully. When I compile my program to an executable using Py2Exe
most of my images do not display - Enabled Toolbar Images are present,
but Disabled Toolbar Images are missing. List Item Images do not
display.
I've reviewed the contents of the library.bin file created with Py2Exe
and the resource folder that contains my images is present and
intact. I don't receive any kind of stack traces to investigate and
the program appears to function properly, though the display is hokey
without the images in place. I don't know that a standalone
demonstration will be feasible, but I'm working on trying to create
something that demonstrates the issue.
I do this sort of thing and it works fine for me. What I also do is
put all images into one images file and then import that into the
modules as needed. This way you know they are all in one place,
easily searchable, etc. Also, that images file is in the same folder
as all the other .py files. I'm not sure if this matters to py2exe,
but maybe the issue is that it is not finding the other folder you
created with the img2py files.
Che
···
On Fri, Nov 5, 2010 at 2:21 PM, g.d.d.c <dancasper@gmail.com> wrote:
I have an Eclipse Project that uses a variety of Images (Toolbar
Buttons, Menu Icons, Program Icons, List Icons, etc). Initially I was
using things like wx.Bitmap to load the image files directly. After
compiling to executable with Py2Exe I encountered a number of problems
related to relative paths - images could not be located.
Following the steps out lined here: My experiences building a small app with ... [SOLVED] | DaniWeb
I was able to overcome some of the relative path problems, but the
necessary changes to my code convoluted it further than I wanted, so I
opted to investigate the Img2Py alternatives.
Using Img2Py I was able to create a resource folder that contains the
necessary images stored as .py files. When I launch my application
from Eclipse in either Debug or Run mode, everything works
beautifully. When I compile my program to an executable using Py2Exe
most of my images do not display - Enabled Toolbar Images are present,
but Disabled Toolbar Images are missing. List Item Images do not
display.
I was able to overcome this (kind of) by adding the append=True option
to my calls to img2py and by removing underscores in the image module
names. I don't understand why this had an effect considering that the
images that worked also contained underscores in their names, but it
appears to have allowed me to step around the problem.
···
On Nov 5, 12:21 pm, "g.d.d.c" <dancas...@gmail.com> wrote:
I have an Eclipse Project that uses a variety of Images (Toolbar
Buttons, Menu Icons, Program Icons, List Icons, etc). Initially I was
using things like wx.Bitmap to load the image files directly. After
compiling to executable with Py2Exe I encountered a number of problems
related to relative paths - images could not be located.
Following the steps out lined here:My experiences building a small app with ... [SOLVED] | DaniWeb
I was able to overcome some of the relative path problems, but the
necessary changes to my code convoluted it further than I wanted, so I
opted to investigate the Img2Py alternatives.
Using Img2Py I was able to create a resource folder that contains the
necessary images stored as .py files. When I launch my application
from Eclipse in either Debug or Run mode, everything works
beautifully. When I compile my program to an executable using Py2Exe
most of my images do not display - Enabled Toolbar Images are present,
but Disabled Toolbar Images are missing. List Item Images do not
display.
I've reviewed the contents of the library.bin file created with Py2Exe
and the resource folder that contains my images is present and
intact. I don't receive any kind of stack traces to investigate and
the program appears to function properly, though the display is hokey
without the images in place. I don't know that a standalone
demonstration will be feasible, but I'm working on trying to create
something that demonstrates the issue.
Any advise or suggestions are much appreciated. Thanks in advance,
--Dan
Thanks for the suggestions so far. Combining the files into a single
resource seemed to help, though I'm at a loss to explain why. I have
one other minor quirk - when I run from Eclipse my images (which were
PNG to begin with) display as I'd expect them to. After I've run
Py2Exe the images have unsightly black boxes around them where there
should be transparency. Any idea what's causing that?
--Dan
···
On Nov 5, 1:51 pm, "g.d.d.c" <dancas...@gmail.com> wrote:
I was able to overcome this (kind of) by adding the append=True option
to my calls to img2py and by removing underscores in the image module
names. I don't understand why this had an effect considering that the
images that worked also contained underscores in their names, but it
appears to have allowed me to step around the problem.
On Nov 5, 12:21 pm, "g.d.d.c" <dancas...@gmail.com> wrote:
> I have an Eclipse Project that uses a variety of Images (Toolbar
> Buttons, Menu Icons, Program Icons, List Icons, etc). Initially I was
> using things like wx.Bitmap to load the image files directly. After
> compiling to executable with Py2Exe I encountered a number of problems
> related to relative paths - images could not be located.
> Following the steps out lined here:My experiences building a small app with ... [SOLVED] | DaniWeb
> I was able to overcome some of the relative path problems, but the
> necessary changes to my code convoluted it further than I wanted, so I
> opted to investigate the Img2Py alternatives.
> Using Img2Py I was able to create a resource folder that contains the
> necessary images stored as .py files. When I launch my application
> from Eclipse in either Debug or Run mode, everything works
> beautifully. When I compile my program to an executable using Py2Exe
> most of my images do not display - Enabled Toolbar Images are present,
> but Disabled Toolbar Images are missing. List Item Images do not
> display.
> I've reviewed the contents of the library.bin file created with Py2Exe
> and the resource folder that contains my images is present and
> intact. I don't receive any kind of stack traces to investigate and
> the program appears to function properly, though the display is hokey
> without the images in place. I don't know that a standalone
> demonstration will be feasible, but I'm working on trying to create
> something that demonstrates the issue.
> Any advise or suggestions are much appreciated. Thanks in advance,
> --Dan
I managed to get it working - I took the ones that were proving
problematic and re-ran them with a maskClr value of '000000'. They're
a little rough around the edges after compiling, but they're close
enough that it should fly for our requirements. Thanks for all your
help.
···
On Nov 5, 2:10 pm, "g.d.d.c" <dancas...@gmail.com> wrote:
Thanks for the suggestions so far. Combining the files into a single
resource seemed to help, though I'm at a loss to explain why. I have
one other minor quirk - when I run from Eclipse my images (which were
PNG to begin with) display as I'd expect them to. After I've run
Py2Exe the images have unsightly black boxes around them where there
should be transparency. Any idea what's causing that?
--Dan
On Nov 5, 1:51 pm, "g.d.d.c" <dancas...@gmail.com> wrote:
> I was able to overcome this (kind of) by adding the append=True option
> to my calls to img2py and by removing underscores in the image module
> names. I don't understand why this had an effect considering that the
> images that worked also contained underscores in their names, but it
> appears to have allowed me to step around the problem.
> On Nov 5, 12:21 pm, "g.d.d.c" <dancas...@gmail.com> wrote:
> > I have an Eclipse Project that uses a variety of Images (Toolbar
> > Buttons, Menu Icons, Program Icons, List Icons, etc). Initially I was
> > using things like wx.Bitmap to load the image files directly. After
> > compiling to executable with Py2Exe I encountered a number of problems
> > related to relative paths - images could not be located.
> > Following the steps out lined here:My experiences building a small app with ... [SOLVED] | DaniWeb
> > I was able to overcome some of the relative path problems, but the
> > necessary changes to my code convoluted it further than I wanted, so I
> > opted to investigate the Img2Py alternatives.
> > Using Img2Py I was able to create a resource folder that contains the
> > necessary images stored as .py files. When I launch my application
> > from Eclipse in either Debug or Run mode, everything works
> > beautifully. When I compile my program to an executable using Py2Exe
> > most of my images do not display - Enabled Toolbar Images are present,
> > but Disabled Toolbar Images are missing. List Item Images do not
> > display.
> > I've reviewed the contents of the library.bin file created with Py2Exe
> > and the resource folder that contains my images is present and
> > intact. I don't receive any kind of stack traces to investigate and
> > the program appears to function properly, though the display is hokey
> > without the images in place. I don't know that a standalone
> > demonstration will be feasible, but I'm working on trying to create
> > something that demonstrates the issue.
> > Any advise or suggestions are much appreciated. Thanks in advance,
> > --Dan
It sounds like your .exe is not using the new themed common controls, the older common controls DLL does not support alpha in bitmaps. Normally the use of the new common controls depends on the presence of a manifest file or resource embedded in your .exe, depending on which version of Python/wxPython you are using. Search for py2exe or manifest in the wiki for some more explanations and examples.
···
On 11/5/10 1:10 PM, g.d.d.c wrote:
Thanks for the suggestions so far. Combining the files into a single
resource seemed to help, though I'm at a loss to explain why. I have
one other minor quirk - when I run from Eclipse my images (which were
PNG to begin with) display as I'd expect them to. After I've run
Py2Exe the images have unsightly black boxes around them where there
should be transparency. Any idea what's causing that?
If you want, and I'm not sure if this will help: try resaving them in
your image editing app as GIFs and see if that is better. I've had
some problems with transparency using PNGs that were cleared up after
using GIFs.
Che
···
On Fri, Nov 5, 2010 at 4:33 PM, g.d.d.c <dancasper@gmail.com> wrote:
I managed to get it working - I took the ones that were proving
problematic and re-ran them with a maskClr value of '000000'. They're
a little rough around the edges after compiling, but they're close
enough that it should fly for our requirements. Thanks for all your
help.
If you want, and I'm not sure if this will help: try resaving them in
your image editing app as GIFs and see if that is better. I've had
some problems with transparency using PNGs that were cleared up after
using GIFs.
Che
···
On Fri, Nov 5, 2010 at 4:33 PM, g.d.d.c <dancasper@gmail.com> wrote:
I managed to get it working - I took the ones that were proving
problematic and re-ran them with a maskClr value of '000000'. They're
a little rough around the edges after compiling, but they're close
enough that it should fly for our requirements. Thanks for all your
help.
There are very important disadvantages when using GIF’s. The GIF, compared to the PNG, is a relatively ancient image file standard. A PNG with color gradients might have more than the GIF maximum of 256 colors. GIF’s don’t support alpha (variable) transparency. Only one color can be assigned to be transparent, and it is fully transparent. Finally, GIF files don’t support data compression at all.
I managed to get it working - I took the ones that were proving
problematic and re-ran them with a maskClr value of ‘000000’. They’re
a little rough around the edges after compiling, but they’re close
enough that it should fly for our requirements. Thanks for all your
help.
If you want, and I’m not sure if this will help: try resaving them in
your image editing app as GIFs and see if that is better. I’ve had
some problems with transparency using PNGs that were cleared up after
I seem to run into trouble when I attempt to include a manifest. I've
tried following the instructions here: CreatingStandaloneExecutables - wxPyWiki.
Py2Exe still works, but if I've included a manifest the program won't
launch citing that it is missing MSVCR90.dll.
Next, I found steps here for including the DLLS manually here: Tutorial - py2exe.org. The steps outlined here
don't seem to work on my system - I still get an error about
MSVCR90.dll after following the steps to place the files where they
need to be.
Any thoughts as to what I'm missing on this? Thanks again for all the
help,
--Dan
···
On Nov 5, 3:08 pm, Robin Dunn <ro...@alldunn.com> wrote:
On 11/5/10 1:10 PM, g.d.d.c wrote:
> Thanks for the suggestions so far. Combining the files into a single
> resource seemed to help, though I'm at a loss to explain why. I have
> one other minor quirk - when I run from Eclipse my images (which were
> PNG to begin with) display as I'd expect them to. After I've run
> Py2Exe the images have unsightly black boxes around them where there
> should be transparency. Any idea what's causing that?
It sounds like your .exe is not using the new themed common controls,
the older common controls DLL does not support alpha in bitmaps.
Normally the use of the new common controls depends on the presence of a
manifest file or resource embedded in your .exe, depending on which
version of Python/wxPython you are using. Search for py2exe or manifest
in the wiki for some more explanations and examples.
--
Robin Dunn
Software Craftsmanhttp://wxPython.org
I seem to run into trouble when I attempt to include a manifest. I've
tried following the instructions here: CreatingStandaloneExecutables - wxPyWiki.
Py2Exe still works, but if I've included a manifest the program won't
launch citing that it is missing MSVCR90.dll.
Next, I found steps here for including the DLLS manually here: Tutorial - py2exe.org. The steps outlined here
don't seem to work on my system - I still get an error about
MSVCR90.dll after following the steps to place the files where they
need to be.
Any thoughts as to what I'm missing on this? Thanks again for all the
help,
Well you are missing MSVCR90.dll,
You need to include it in your py2exe output directory. When you run
'setup.py py2exe' read the output at the end, it should be in the list
of dll's that you 'might' need to include. Typically you need the
Microsoft C runtimes (MSVCR) and the gdiplus dll from the wxPython
installation included with your binaries.
Cody
···
On Mon, Nov 8, 2010 at 10:40 AM, g.d.d.c <dancasper@gmail.com> wrote:
The crux of the issue is that I'm not missing the file, even though
that's the error being reported. It's installed on my system, I've
followed steps from other Wiki Pages to place the necessary copies in
the dist directory for my program, and I don't receive the error
unless I've followed the steps here to embed a manifest into the
executable: CreatingStandaloneExecutables - wxPyWiki.
That says to me that the problem is elsewhere. Also, for what it's
worth, the output from Py2Exe lists these DLLs as required by my
application:
You'll notice that while MSVCP71.dll is in this list, MSVCR90.dll is
not. I'm also unaccustomed to getting missing DLL errors on the
system where I've compiled my application - all of the necessary
runtimes are already installed on my development machine. I'd expect
those types of errors on another machine that doesn't have the
runtimes present, and usually simply install the C++ 2008 Runtime for
Python 2.6. This isn't the first time I've compiled a program using
Py2Exe - I'm familiar with most of the common pitfalls, but this is
the first one I've dealt with that uses wxPython heavily and I'm
getting behavior that does not mesh with my prior experiences.
--Dan
···
On Nov 8, 9:45 am, Cody Precord <codyprec...@gmail.com> wrote:
Hi,
On Mon, Nov 8, 2010 at 10:40 AM, g.d.d.c <dancas...@gmail.com> wrote:
> Robin,
> I seem to run into trouble when I attempt to include a manifest. I've
> tried following the instructions here:CreatingStandaloneExecutables - wxPyWiki.
> Py2Exe still works, but if I've included a manifest the program won't
> launch citing that it is missing MSVCR90.dll.
> Next, I found steps here for including the DLLS manually here:
>Tutorial - py2exe.org. The steps outlined here
> don't seem to work on my system - I still get an error about
> MSVCR90.dll after following the steps to place the files where they
> need to be.
> Any thoughts as to what I'm missing on this? Thanks again for all the
> help,
Well you are missing MSVCR90.dll,
You need to include it in your py2exe output directory. When you run
'setup.py py2exe' read the output at the end, it should be in the list
of dll's that you 'might' need to include. Typically you need the
Microsoft C runtimes (MSVCR) and the gdiplus dll from the wxPython
installation included with your binaries.
After some additional digging through the Wiki I found this page that
solved the problem: py2exe-python26 - wxPyWiki. It
would appear that the issue (or at least part of it) was that my
Manifest was improperly structured. That takes care of the DLL
Dependencies, fixed the image transparencies, and also cleaned up the
image edges. Thanks for all the help everyone.
···
On Nov 8, 10:14 am, "g.d.d.c" <dancas...@gmail.com> wrote:
Cody,
The crux of the issue is that I'm not missing the file, even though
that's the error being reported. It's installed on my system, I've
followed steps from other Wiki Pages to place the necessary copies in
the dist directory for my program, and I don't receive the error
unless I've followed the steps here to embed a manifest into the
executable:CreatingStandaloneExecutables - wxPyWiki.
That says to me that the problem is elsewhere. Also, for what it's
worth, the output from Py2Exe lists these DLLs as required by my
application:
You'll notice that while MSVCP71.dll is in this list, MSVCR90.dll is
not. I'm also unaccustomed to getting missing DLL errors on the
system where I've compiled my application - all of the necessary
runtimes are already installed on my development machine. I'd expect
those types of errors on another machine that doesn't have the
runtimes present, and usually simply install the C++ 2008 Runtime for
Python 2.6. This isn't the first time I've compiled a program using
Py2Exe - I'm familiar with most of the common pitfalls, but this is
the first one I've dealt with that uses wxPython heavily and I'm
getting behavior that does not mesh with my prior experiences.
--Dan
On Nov 8, 9:45 am, Cody Precord <codyprec...@gmail.com> wrote:
> Hi,
> On Mon, Nov 8, 2010 at 10:40 AM, g.d.d.c <dancas...@gmail.com> wrote:
> > Robin,
> > I seem to run into trouble when I attempt to include a manifest. I've
> > tried following the instructions here:CreatingStandaloneExecutables - wxPyWiki.
> > Py2Exe still works, but if I've included a manifest the program won't
> > launch citing that it is missing MSVCR90.dll.
> > Next, I found steps here for including the DLLS manually here:
> >Tutorial - py2exe.org. The steps outlined here
> > don't seem to work on my system - I still get an error about
> > MSVCR90.dll after following the steps to place the files where they
> > need to be.
> > Any thoughts as to what I'm missing on this? Thanks again for all the
> > help,
> Well you are missing MSVCR90.dll,
> You need to include it in your py2exe output directory. When you run
> 'setup.py py2exe' read the output at the end, it should be in the list
> of dll's that you 'might' need to include. Typically you need the
> Microsoft C runtimes (MSVCR) and the gdiplus dll from the wxPython
> installation included with your binaries.
I can't dispute most of your points, but two of them deserve comment.
The GIF, compared to the PNG, is a relatively ancient image file standard.
"Ancient" does not necessarily imply worse. "Ancient" means it is
heavily used, well-supported, and extremely well-tested. PNG finally
has broad browser support, but it took quite a while to get there.
Finally, GIF files don't support data compression at all.
I think you were trying to say something else here. GIF files are LZW
compressed, just like a zip file. It's true they do not support lossy
compression, like a JPEG.
···
On Nov 7, 8:38 pm, Ray Pasco <pascor22...@gmail.com> wrote:
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
I can’t dispute most of your points, but two of them deserve comment.
The GIF, compared to the PNG, is a relatively ancient image file standard.
“Ancient” does not necessarily imply worse. “Ancient” means it is
heavily used, well-supported, and extremely well-tested. PNG finally
has broad browser support, but it took quite a while to get there.
A better word to describe the GIF is archaic or outmoded - it has much better alternitives in the vast majority of applications.
Finally, GIF files don’t support data compression at all.
I think you were trying to say something else here. GIF files are LZW
compressed, just like a zip file. It’s true they do not support lossy
compression, like a JPEG.
Probably ! I can’t seem to recall… I can think of only 4 well known formats that are lossless: BMP, GIF, PNG and TIFF, but TIFF is a specialty format and BMP files are uncompressed - much more “archaic” than GIF.
···
On Mon, Nov 8, 2010 at 1:15 PM, Tim Roberts timr@probo.com wrote:
I can’t dispute most of your points, but two of them deserve comment.
The GIF, compared to the PNG, is a relatively ancient image file standard.
“Ancient” does not necessarily imply worse. “Ancient” means it is
heavily used, well-supported, and extremely well-tested. PNG finally
has broad browser support, but it took quite a while to get there.
A better word to describe the GIF is archaic or outmoded - it has much better alternitives in the vast majority of applications.
Finally, GIF files don’t support data compression at all.
I think you were trying to say something else here. GIF files are LZW
compressed, just like a zip file. It’s true they do not support lossy
compression, like a JPEG.
Probably ! I can’t seem to recall… I can think of only 4 well known formats that are lossless: BMP, GIF, PNG and TIFF, but TIFF is a specialty format and BMP files are uncompressed - much more “archaic” than GIF.
IIRC GIF supported lossless compression via LZW until an unscrupulous company decided to try and charge a licence fee on a patent it had bought – then rather than bowing to their demands just about everybody dropped the support for compressed images within GIF files.
I don't want to seem like I'm beating a dead horse, even though that's
clearly what I'm doing, but I don't see why you say this. GIF offers
lossless compression, which makes it a winner over BMP. GIFs are
simpler than PNGs, and far simpler than TIFFs. For situations where
you need lossless compression at 8 bits per pixel, I don't see
anything wrong with the GIF format.
A developer needs to have a whole collection of tools in his toolbox.
In an image-intensive application, where I was going to need to
support true-color, then I might as well make everything PNG, but I
don't think it's necessary to bury GIF just yet.
···
On Nov 9, 9:23 am, Ray Pasco <pascor22...@gmail.com> wrote:
A better word to describe the GIF is *archaic* or *outmoded* - it has much
better alternitives in the vast majority of applications.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc
Well, sort of. Unisys does own a patent on LZW compression, and did
try to extract royalty dollars from companies using GIFs. Whether
that makes them unscrupulous or not is a matter of opinion. They were
certainly well within their rights in the law. Whether the law is in
the best interests of society or not is a topic worthy of debate.
Just ask Richard Stallman...
Strictly speaking, there's no such thing as an uncompressed GIF,
although there is a trick to simulate one. Some applications did drop
GIF support for a while (certainly not "just about everybody"), but
the effect of the Unisys onslaught was mostly righteously indignant
waving of hands and gnashing of teeth. The patent expired in 2003,
and everything went back to the way it was before.
···
On Nov 9, 9:28 am, Steve Barnes <GadgetSt...@live.co.uk> wrote:
IIRC GIF supported lossless compression via LZW until an unscrupulous company decided to try and charge a licence fee on a
patent it had bought – then rather than bowing to their demands just about everybody dropped the support for compressed
images within GIF files.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc
Yes and another test of it, at least for me: it looks just fine. PNG
gave me a problem with transparency; GIF doesn't. That's all I need
to know for my purposes.
Che
···
On Tue, Nov 9, 2010 at 12:39 PM, Tim Roberts <timr@probo.com> wrote:
On Nov 9, 9:23 am, Ray Pasco <pascor22...@gmail.com> wrote:
A better word to describe the GIF is *archaic* or *outmoded* - it has much
better alternitives in the vast majority of applications.
I don't want to seem like I'm beating a dead horse, even though that's
clearly what I'm doing, but I don't see why you say this. GIF offers
lossless compression, which makes it a winner over BMP. GIFs are
simpler than PNGs, and far simpler than TIFFs. For situations where
you need lossless compression at 8 bits per pixel, I don't see
anything wrong with the GIF format.
A developer needs to have a whole collection of tools in his toolbox.
In an image-intensive application, where I was going to need to
support true-color, then I might as well make everything PNG, but I
don't think it's necessary to bury GIF just yet.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc