I am trying to convert the tkinter GUI base program to .exe using py2exe. However, I encountered 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 a newly created .exe file
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 am sure this is something in my conversion script that gives me problems. What did I miss? Or does someone have an example of what the conversion of the script for the tkinter GUI program will look like? Also, is it possible to redirect the output .exe files to the desktop?
EDIT:
The error report indicates that I am missing init.tcl from {C: /Users/My_name/lib/tcl8.5} . So I created this directory and placed a copy of init.tcl there . Now, when I try to run .exe, it indicates that MSVCR90.dll is missing on my computer and is needed to run my program.
Also this is python 2.6.5 on Windows 7.
source share