The following code can be entered in a Tcl shell (
or into a script file and run through a Tcl shell:
puts "Hello, world!"
It gives the string argument
Hello, world! to the command
puts command writes its argument to standard out (your terminal in interactive mode) and adds a newline afterwards.
In a Tk-enabled shell, this variation can be used:
pack [button .b -text "Hello, world!" -command exit]
It creates a graphic button with the text
and adds it to the application window. When pressed,
the application exits.
A Tk-enabled shell is started as:
tclsh along with the following statement:
package require Tk