py2exe issues with pictures and icons

A

Alexnb

Hello

I am sure most of you are familiar with py2exe. I am having a bit of a
problem. See the program has a few pictures involved and the .ico it uses
for the windows. However, the pictures are stored in the same directory as
the source, something like: C:\Docs and settings\me\My docs\python\program.
When I run the program for the interpreter, just as a .py, everything works
just as it should. However, when I compile the main source as an .exe, and
say let a friend try the program. It fails because it is missing the .ico.
The catch, is I don't want to have it have to installed, at least at this
point, I want it to be able to just run. So how can I make it just run from
any computer with the files not being in the immediate directory. If that is
not possible, how can I put them in the immediate directory and still make
it work. Because that directory may change a lot so the path will change.

Just a few questions. I hope someone out there can help me out!
 
M

Mike Driscoll

Hello

I am sure most of you are familiar with py2exe. I am having a bit of a
problem. See the program has a few pictures involved and the .ico it uses
for the windows. However, the pictures are stored in the same directory as
the source, something like: C:\Docs and settings\me\My docs\python\program.
When I run the program for the interpreter, just as a .py, everything works
just as it should. However, when I compile the main source as an .exe, and
say let a friend try the program. It fails because it is missing the .ico..
The catch, is I don't want to have it have to installed, at least at this
point, I want it to be able to just run. So how can I make it just run from
any computer with the files not being in the immediate directory. If that is
not possible, how can I put them in the immediate directory and still make
it work. Because that directory may change a lot so the path will change.

Just a few questions. I hope someone out there can help me out!


Put the part of the code that needs the ico file(s) into a try/except
block. You could also try reading the py2exe wiki and tutorials. This
one looks like it has relevant data:

http://www.py2exe.org/index.cgi/CustomIcons

Mike
 
A

Alexnb

Alexnb said:
Well, that may solve the icon problem. But what about getting pictures in
there?

Okay, the icon fix didn't really fix it, what it did was make the .exe have
the icon as the little picture for the shortcut, but it isn't really a
shortcut. Whatever. But, I went and ran it on another computer and this was
the error log it created right off the bat.

Traceback (most recent call last):
File "The GUI.py", line 696, in <module>
File "Tkinter.pyc", line 1515, in wm_iconbitmap
_tkinter.TclError: bitmap "C:\Documents and Settings\Alex\My
Documents\PYTHON\DictionaryApp\Windows.ico" not defined
 
M

Mike Driscoll

Okay, the icon fix didn't really fix it, what it did was make the .exe have
the icon as the little picture for the shortcut, but it isn't really a
shortcut. Whatever. But, I went and ran it on another computer and this was
the error log it created right off the bat.

Traceback (most recent call last):
  File "The GUI.py", line 696, in <module>
  File "Tkinter.pyc", line 1515, in wm_iconbitmap
_tkinter.TclError: bitmap "C:\Documents and Settings\Alex\My
Documents\PYTHON\DictionaryApp\Windows.ico" not defined

Crumb! I actually use a GUI wrapper for py2exe called GUI2Exe which
makes this sort of thing much easier. Unfortunately, it also makes me
less knowledgeable. You can check it out here:

http://xoomer.alice.it/infinity77/main/GUI2Exe.html

Also, there's a distutils group and a py2exe group. Both of them would
know a lot more about how to do this.

https://lists.sourceforge.net/lists/listinfo/py2exe-users
http://www.python.org/community/sigs/current/distutils-sig/list/

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Image issues 0
Range / empty list issues?? 1
Py2exe 0
Issues with writing pytest 0
pygtk - icons? 0
Problem with smtplib and py2exe 3
py2exe and 64/32 bit windows 3
Question on Creating exe file with py2exe 5

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top