A simple tcl/tk program to run Python.

SA sarmstrong13 at mac.com
Wed Jun 5 00:28:50 EDT 2002


Found Typo. Here is corrected script:

#!/usr/bin/wish

text .t1 -height 12 -width 84 -font {Times 12}
frame .f
text .t2 -height 8 -width 84 -bg lightblue -font {Courier 9}
button .f.b1 -text Execute -command python
button .f.b2 -text "Clear input" -command ".t1 delete 0.0 end"
button .f.b3 -text "Clear output" -command ".t2 delete 0.0 end"
pack .f.b1 .f.b2 .f.b3 -side left -padx 2
pack .t1 .f .t2 -side top -pady 2

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




More information about the Python-list mailing list