Embedding Python & tkinter into c app.

FreakyFread at nospam.com FreakyFread at nospam.com
Fri May 25 00:56:11 EDT 2001


I am trying to use Python as a scripting language for my app.  I got
it running with simple scripts and exposed some functions from my app
to Python and they can be called just fine from the script.  Now I am
trying to use tkinter to produce a few gui's.  I can create scripts
outside of the app which bring up gui's but when I run them from in my
app they crash.  It seems to be a pathing problem in finding the
libraries.  Are there methods I am not seeing to tell tkinter where to
look for its libraries?  Or is there an environment variable I may not
have set.  Here is the simple script that works with the python
interpreter and not in the embedded version.  Also I am working on NT
SP6 and windows 200 (both have problem).

Script:
from Tkinter import *

root = Tk()

w = Label(root, text="Hello, world!")
w.pack()

root.mainloop()

Error:
Adding parser accelerators ...
Done.
Traceback (most recent call last):
  File "<string>", line 4, in ?
  File "c:\python21\lib\lib-tk\Tkinter.py", line 1480, in
    self.tk = _tkinter.create(screenName, baseName, class
TclError: Can't find a usable init.tcl in the following d
    {} D:/lib/tcl8.3 D:/GameDev/PTest/lib/tcl8.3 D:/GameD
v/lib/tcl8.3/library D:/GameDev/library D:/GameDev/../tcl
3/library



This probably means that Tcl wasn't installed properly.

Any help would be appreciated,
Erik Johnson
erikj at gci-net.com



More information about the Python-list mailing list