[Tutor] Python - TCL Interaction

Jayanthi, Satya Padmaja (Satya Padmaja) padmaja at agere.com
Wed Sep 1 13:50:28 CEST 2004


Hi :

I am using Tkinker to interface Python to TCL. I am able to call tcl
APIs, pass the input parameters as strings to the TCL APIs, fetch the
return values from the TCL APIs etc... From the python code. 

Now, the problem is I have to pass a two dimensional list (the elements
of the list are also lists) to the tcl file. How can I do it ? If I
simply use the "%s" option, the error that is thrown is
"_tkinter.TclError: invalid command name "'apple',""

	import Tkinter

	root = Tkinter.Tk()
	root.tk.eval('source test_tcl_file.tcl')

	arr = [["apple", "mango", "orange"], ["rose", "jasmine",
"marigold"]]
	root.tk.eval('test_tcl_func %s', %(list))

I have tried many tricks.Tried setting the array in the python file etc.
root.tk.eval('global arr; lappend arr %s' %(s)). But nothing works. Can
anyone of you please help me ?

Thanks and Regards,
Padmaja 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040901/b3378d2c/attachment.htm


More information about the Tutor mailing list