Translating Tcl/Tk code into Python/Tkinter help please...

SA sarmstrong13 at
Thu Jun 13 13:36:17 EDT 2002

Hi Everyone-

    I am trying to translate a tcl program that use tk into python. I seem
to be going along fine until I get to the process that wants to "catch" the
results onto one text screen. Here is what I am looking at:

proc python {} {
    catch {exec /sw/bin/python -c [.t1 get 0.0 end]} output
    .t2 delete 0.0 end
    .t2 insert end $output

Basically, this process catches the output from running the code in the text
widget .t1 through python -c and places it into the variable ouput.
The text widget .t2 is then cleared and the contents of the variable $output
are displayed in the text widget .t2.

I can translate all of the widgets into python/tkinter code, but I'm not
sure about how to translate this process. Is there a function similar to
"catch" in Python?


More information about the Python-list mailing list