Tuesday, 15 May 2012

python - Packaging Images in py2exe? -



python - Packaging Images in py2exe? -

i having problem packaging python tkinter gui file .exe executable file py2exe. when finish building application through command prompt , open .exe application converted, error:

traceback(most recent phone call last): file "gui.py", line 15, in <module> file "tkinter.pyc", line 1624, in wm_iconbitmap _tkinter.tclerror: bitmap "tsicon.ico" not defined

how py2exe able function images set tkinter python file , convert python file .exe executable.

it seems problem tsicon.ico not copied same folder .exe file resides. assume python file , tsicon.ico in same folder. then, setup.py should this:

from distutils.core import setup import py2exe data_files = [('', [r'tsicon.ico'])] setup( windows =['tk_with_image.py'], data_files = data_files, options={ } )

now .exe file , tsicon.ico in same folder (dist), , should work.

python user-interface tkinter py2exe

No comments:

Post a Comment