mcfly
mcfly

Reputation: 1151

Running TCL code from Python

I want to be able to run a tcl script out of my python script. Specifically, I want to run a tcl script much like this.

I have some knowledge of python and none of tcl.

I have been trying things like:

import Tkinter
r=Tkinter.Tk()
r.call('source{DIS.tcl})' or r.tk.eval('source{DIS.tcl})'

Any ideas how i would access things out of the tcl script? Thanks!

Upvotes: 7

Views: 14646

Answers (2)

fahad
fahad

Reputation: 3179

Try this

import Tkinter
r=Tkinter.Tcl()
r.eval('source DIS.tcl')

Upvotes: 9

glenn jackman
glenn jackman

Reputation: 246764

Tcl is very sensitive to whitespace (much like Bourne shell). You probably want source DIS.tcl instead of source{DIS.tcl}

Upvotes: 4

Related Questions