[Tutor] Python - TCL Interaction

Kent Johnson kent_johnson at skillsoft.com
Wed Sep 1 22:46:38 CEST 2004


I'm curious, can you tell us why you are using this architecture? Why not 
use Tcl/Tk or Tkinter/Python?

Thanks,
Kent

At 05:20 PM 9/1/2004 +0530, Jayanthi, Satya Padmaja (Satya Padmaja) wrote:
>content-class: urn:content-classes:message
>Content-Type: multipart/alternative;
>  boundary="----_=_NextPart_001_01C49019.E02077E0"
>Content-Transfer-Encoding: 7bit
>
>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
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list