embedding tcl interpreter in Python
Ed Warnicke
hagbard at physics.rutgers.edu
Tue Oct 22 17:45:22 EDT 2002
I know that the following has floated by from time to time, but I thought
I'd bring it up again.
Due to the extensive use of Tcl by test equipment manufacturers, and my
desire
to use Python instead of Tcl for my script development, I find myself in
need of
a Tcl interpreter embedded in Python.
It is clear to me that this has already been done in Tkinter, and
done much better than I am likely to do by myself. I do not see a
good clean way to use this embedding of Tcl in environments were
I have no interest in Tk. What I have tried thus far is
Python 2.2.2 (#4, Oct 15 2002, 04:21:28)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> tk = Tkinter.Tk()
>>> tk.destroy()
>>> tcl = tk.tk
>>> tcl.eval("puts a")
a
''
>>>
which pretty much works. But if you have no DISPLAY variable set you
have troubles,
due to the inherent Tkness ( creating a Tkinter.Tk object barfs if you
have no display
set).
What I would like to ask is the following:
1) Does someone have a cleaner, more functional way of embedding Tcl
in Python
than the hack I showed above.
2) If not, is there any interest in incorporating a Tkinter.Tcl()
object into
Tkinter that would allow the embedding of a Tcl interpreter without
the Tk
baggage? I'm more than willing to write code, if there is some
interest in
incorporating it.
Ed
More information about the Python-list
mailing list