views:

47

answers:

0

I'm trying to convert a basic tkinter GUI program to an .exe using py2exe. However I've run into an error using the following conversion script.

# C:\Python26\test_hello_con.py py2exe

from distutils.core import setup
import py2exe

setup(windows=[r'C:\Python26\py2exe_test_tk.py'])

C:\Python26\py2exe_test_tk.py is the following code

import Tkinter as tk

root = tk.Tk()
root.title("Test")


label1 = tk.Label(root,text="Hello!",font=('arial', 10, 'bold'), bg='lightblue')
label1.pack(ipadx=100, ipady=100)


root.mainloop()

This is the error I get when I try to run the newly created .exe

Traceback (most recent call last):
  File "py2exe_test_tk.py", line 4, in <module>
  File "Tkinter.pyc", line 1643, in __init__
_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
    {C:/Users/My_Name/lib/tcl8.5} {C:/Users/My_Name/lib/tcl8.5} C:/Users/lib/tcl8.5 {C:/Users/My_Name/library} C:/Users/library C:/Users/tcl8.5.8/library C:/tcl8.5.8/library



This probably means that Tcl wasn't installed properly.

I'm pretty sure it's something in my conversion script thats giving me problems. What did I omit? Or does someone have an example of what the conversion script would look like for a tkinter GUI program? Also is it possible to divert the output .exe files to my desktop?

EDIT:

The error report said that I was missing init.tcl from {C:/Users/My_name/lib/tcl8.5}. So i made that directory and put a copy of init.tcl there. Now when I try to run the .exe it states that MSVCR90.dll is missing from my computer and is needed to run my program.

Also this is python 2.6.5 on Windows 7.