A selection of C and Tcl functions exist for outputting text to either the
stdout or stderr streams. For entirely text based applications these messages
simply appear on their usual streams. For graphical applications the messages
can appear in the main window of the application. The programmer is free to
use the usual C output routines, such as printf
, but doing so will no
output to the main window.
To utilise the text based version of the routines no initialisation is
required. For the windowing version the following startup code should be used
from within stash
.
tkinit pack [frame .output -relief raised -bd 2] -fill both -expand 1 load_package tk_utils tout_create_wins .output
In the above example .output
can be replaced by any window name you
choose. The load_package tk_utils
command is required to load the
tk_utils_defs variable. The tout_create_wins
command does the
actual work of creating the necessary output and error windows. From then on,
the text output routines will send data to the windows instead of stdout and
stderr.