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?

2 Answers 2

1

You may have just forgotten to define your icon:

cfg = {
    'py2exe.icon':'icon.ico',
    ...
}
Sign up to request clarification or add additional context in comments.

2 Comments

How exactly would I put this into my code? Do I put it right after I import everything on lines 1 and 2
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')
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
)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.