2 '\" Copyright (c) 2001 Donal K. Fellows
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10 .TH console n 8.4 Tk "Tk Built-In Commands"
12 '\" Note: do not modify the .SH NAME line immediately below!
14 console \- Control the console on systems without a real console
16 \fBconsole title \fR?\fIstring\fR?
22 \fBconsole eval \fIscript\fR
27 The console window is a replacement for a real console to allow input
28 and output on the standard I/O channels on platforms that do not have
29 a real console. It is implemented as a separate interpreter with the
30 Tk toolkit loaded, and control over this interpreter is given through
31 the \fBconsole\fR command. The behaviour of the console window is
32 defined mainly through the contents of the \fIconsole.tcl\fR file in
33 the Tk library (or the \fIConsole\fR resource on Macintosh systems.)
36 \fBconsole eval \fIscript\fR
37 Evaluate the \fIscript\fR argument as a Tcl script in the console
38 interpreter. The normal interpreter is accessed through the
39 \fBconsoleinterp\fR command in the console interpreter.
42 Hide the console window from view. Precisely equivalent to
43 withdrawing the \fB.\fR window in the console interpreter.
46 Display the console window. Precisely equivalent to deiconifying the
47 \fB.\fR window in the console interpreter.
49 \fBconsole title \fR?\fIstring\fR?
50 Query or modify the title of the console window. If \fIstring\fR is
51 not specified, queries the title of the console window, and sets the
52 title of the console window to \fIstring\fR otherwise. Precisely
53 equivalent to using the \fBwm title\fR command in the console
56 .SH "ACCESS TO THE MAIN INTERPRETER"
58 The \fBconsoleinterp\fR command in the console interpreter allows
59 scripts to be evaluated in the main interpreter. It supports two
60 subcommands: \fBeval\fR and \fBrecord\fR.
63 \fBconsoleinterp eval \fIscript\fR
64 Evaluates \fIscript\fR as a Tcl script at the global level in the main
67 \fBconsoleinterp record \fIscript\fR
68 Records and evaluates \fIscript\fR as a Tcl script at the global level
69 in the main interpreter as if \fIscript\fR had been typed in at the
72 .SH "ADDITIONAL TRAP CALLS"
74 There are several additional commands in the console interpreter that
75 are called in response to activity in the main interpreter.
76 \fIThese are documented here for completeness only; they form part of
77 the internal implementation of the console and are likely to change or
78 be modified without warning.\fR
80 Output to the console from the main interpreter via the stdout and
81 stderr channels is handled by invoking the \fBtk::ConsoleOutput\fR
82 command in the console interpreter with two arguments. The first
83 argument is the name of the channel being written to, and the second
84 argument is the string being written to the channel (after encoding
85 and end-of-line translation processing has been performed.)
87 When the \fB.\fR window of the main interpreter is destroyed, the
88 \fBtk::ConsoleExit\fR command in the console interpreter is called
89 (assuming the console interpreter has not already been deleted itself,
92 .SH "DEFAULT BINDINGS"
94 The default script creates a console window (implemented using a text
95 widget) that has the following behaviour:
97 Pressing the tab key inserts a TAB character (as defined by the Tcl
100 Pressing the return key causes the current line (if complete by the
101 rules of \fBinfo complete\fR) to be passed to the main interpreter for
104 Pressing the delete key deletes the selected text (if any text is
105 selected) or the character to the right of the cursor (if not at the
108 Pressing the backspace key deletes the selected text (if any text is
109 selected) or the character to the left of the cursor (of not at the
112 Pressing either Control+A or the home key causes the cursor to go to
113 the start of the line (but after the prompt, if a prompt is present on
116 Pressing either Control+E or the end key causes the cursor to go to
119 Pressing either Control+P or the up key causes the previous entry in
120 the command history to be selected.
122 Pressing either Control+N or the down key causes the next entry in the
123 command history to be selected.
125 Pressing either Control+B or the left key causes the cursor to move
126 one character backward as long as the cursor is not at the prompt.
128 Pressing either Control+F or the right key causes the cursor to move
129 one character forward.
131 Pressing F9 rebuilds the console window by destroying all its children
132 and reloading the Tcl script that defined the console's behaviour.
134 Most other behaviour is the same as a conventional text widget except
135 for the way that the \fI<<Cut>>\fR event is handled identically to the
136 \fI<<Copy>>\fR event.
139 console, interpreter, window, interactive, output channels
142 destroy(n), fconfigure(n), history(n), interp(n), puts(n), text(n), wm(n)