1. 导入模块
>>> import tkinter
>>> interp = tkinter.Tcl()
2. 通过eval调用tcl命令,返回值为str
>>> # 调用tcl语句
>>> interp.eval('source xx.tcl')
>>>
>>> # 调用array names返回str,split后赋值给list
>>> list_a0_names = interp.eval('array names a0').split()
>>>
>>> # 调用llength 返回str,int后赋值给整形变量
>>> i_length = int(interp.eval('llength $list0'))
>>>
>>> # 调用lindex返回str
>>> s_key = interp.eval('lindex $list0 0')
3. 通过setvar给变量赋值
>>> interp.setvar('s_tmp', 'this is a tmp string')
4. 通过getvar得到变量的值
>>> interp.getvar('s_tmp') # 'this is a tmp string'
>>>
>>> s_tmp_var = 's_tmp'
>>> interp.getvar(s_tmp_var) # 'this is a tmp string',使用变量名代替's_tmp'