0

I coded a python application with a GUI in Tkinter with pictures. Now that I have finished, I am trying to convert it to a .exe with py2exe. All my pictures are in the same folder as my python file and setup file, but when I try to convert my python file via the Command Prompt, I get error messages saying that my .ico file is not defined and that it can not copy it. I think the problem is due to my setup.py file. How do I allow my images to be copied into the new .exe executable file without getting errors I have never used py2exe before.

Setup file:

from distutils.core import setup
import py2exe

setup(console=['Gui.py'])

Error:

error

How do I fix this?

NorthCat
  • 9,643
  • 16
  • 47
  • 50
Rohan K.
  • 91
  • 5

2 Answers2

1

You may have just forgotten to define your icon:

cfg = {
    'py2exe.icon':'icon.ico',
    ...
}
paulccorey
  • 11
  • 2
  • How exactly would I put this into my code? Do I put it right after I import everything on lines 1 and 2 – Rohan K. Jun 22 '14 at 15:12
  • Sorry, I answered a bit hastily there. I miss-interpreted your error. It seems to be an issue with tkinter, have you set your icon in tkinter? tk.call('wm', 'iconbitmap', self._w, '-default', 'iconfile.ico') – paulccorey Jun 23 '14 at 10:28
0

Try to change your setup.py like this:

from distutils.core import setup
import py2exe

data_files = [('', [r'standardicon.ico'])]

setup(
    windows =['Gui.py'],
    data_files = data_files
)
NorthCat
  • 9,643
  • 16
  • 47
  • 50