how to call user defined TCL procedures from python script?

Stephan Kuhagen nospam at domain.tld
Tue Nov 21 05:41:50 EST 2006


comp.lang.python wrote:

> I am looking for the way to include user define TCL lib to python
> script and call those user define functions from python script.

If you import Tkinter and then evaluate Tcl-Script, passing back the results
a strings into Python. Example:


>>> import Tkinter
>>> tcl=Tkinter.Tk()
>>> tcl.withdraw()
''
>>> tcl.eval("puts hello")
hello
''

With this you can load Tcl-Libs ("package require ..."), execute the needed
functionality and "return $VALUE" to pass results to Python.

HTH
Stephan




More information about the Python-list mailing list