I want to run the script .tcl in the terminal.
I downloaded TCL from and I checked it with the line below, at which a window appears as in the photo.
% C:\ActiveTcl\bin\wish
The script starts with tclsh
, but immediately gives errors. For example, code below show invalid command name "frame"
or invalid command name "button"
.
frame .f2
text .f1.t1 -width 60 -height 20
button .f2.b1 -text "Quit" -width 5 -command {exit}
button .f2.b2 -text "Next" -width 5 -command {module_conf}
Why doesn't it work? Do these code lines refer to TK? Did I install TK with TCL? How can I fix this? What else do I need to download?
Those are commands typical of Tk. To use them, you either need to launch the file with wish
instead of tclsh
, or put this at the top of your script:
package require Tk
These options are largely equivalent on Linux, but less so on Windows and macOS, which differentiate more strongly between programs run in terminals and programs that use the GUI; wish
handles those details for you.