Connecting Tech Pros Worldwide Help | Site Map

how to call user defined TCL procedures from python script?

comp.lang.python
Guest
 
Posts: n/a
#1: Nov 21 '06
Hi,
I am using some TCL driver APIs and user define TCL function to
control a traffic generator. The APIs are the traffic generator's
specific and in built to the driver library.

The issue is calling API and user define TCL functions from python
script.
I am looking for the way to include user define TCL lib to python
script and call those user define functions from python script.
thanks & regards
ananya

Stephan Kuhagen
Guest
 
Posts: n/a
#2: Nov 21 '06

re: how to call user defined TCL procedures from python script?


comp.lang.python wrote:
Quote:
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:

Quote:
Quote:
Quote:
>>import Tkinter
>>tcl=Tkinter.Tk()
>>tcl.withdraw()
''
Quote:
Quote:
Quote:
>>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

Closed Thread