<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6556.0">
<TITLE>Python - TCL Interaction</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi :</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">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. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">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',""</FONT></P>
<P> <FONT SIZE=2 FACE="Arial">import Tkinter</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">root = Tkinter.Tk()</FONT>
<BR> <FONT SIZE=2 FACE="Arial">root.tk.eval('source test_tcl_file.tcl')</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">arr = [["apple", "mango", "orange"], ["rose", "jasmine", "marigold"]]</FONT>
<BR> <FONT SIZE=2 FACE="Arial">root.tk.eval('test_tcl_func %s', %(list))</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">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 ?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thanks and Regards,</FONT>
<BR><FONT SIZE=2 FACE="Arial">Padmaja </FONT>
</P>
<BR>
</BODY>
</HTML>