1console(n)                   Tk Built-In Commands                   console(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       console - Control the console on systems without a real console
9

SYNOPSIS

11       console subcommand ?arg ...?
12_________________________________________________________________
13
14

DESCRIPTION

16       The  console  window is a replacement for a real console to allow input
17       and output on the standard I/O channels on platforms that do not have a
18       real  console.  It is implemented as a separate interpreter with the Tk
19       toolkit loaded, and control over this interpreter is given through  the
20       console command.  The behaviour of the console window is defined mainly
21       through the contents of the console.tcl file in the Tk library (or  the
22       Console resource on Macintosh systems.)
23
24       console eval script
25              Evaluate  the  script  argument  as  a Tcl script in the console
26              interpreter.  The normal interpreter  is  accessed  through  the
27              consoleinterp command in the console interpreter.
28
29       console hide
30              Hide  the  console  window  from  view.  Precisely equivalent to
31              withdrawing the . window in the console interpreter.
32
33       console show
34              Display the console window.  Precisely equivalent to  deiconify‐
35              ing the . window in the console interpreter.
36
37       console title ?string?
38              Query  or  modify the title of the console window.  If string is
39              not specified, queries the title of the console window, and sets
40              the  title of the console window to string otherwise.  Precisely
41              equivalent to using the wm title command in the  console  inter‐
42              preter.
43

ACCESS TO THE MAIN INTERPRETER

45       The  consoleinterp command in the console interpreter allows scripts to
46       be evaluated in the main interpreter.   It  supports  two  subcommands:
47       eval and record.
48
49       consoleinterp eval script
50              Evaluates script as a Tcl script at the global level in the main
51              interpreter.
52
53       consoleinterp record script
54              Records and evaluates script as a Tcl script at the global level
55              in  the  main  interpreter as if script had been typed in at the
56              console.
57

ADDITIONAL TRAP CALLS

59       There are several additional commands in the console  interpreter  that
60       are  called in response to activity in the main interpreter.  These are
61       documented here for completeness only; they form part of  the  internal
62       implementation  of  the console and are likely to change or be modified
63       without warning.
64
65       Output to the console from the main  interpreter  via  the  stdout  and
66       stderr channels is handled by invoking the tk::ConsoleOutput command in
67       the console interpreter with two arguments.  The first argument is  the
68       name  of  the  channel being written to, and the second argument is the
69       string being written to the channel  (after  encoding  and  end-of-line
70       translation processing has been performed.)
71
72       When  the  .  window of the main interpreter is destroyed, the tk::Con‐
73       soleExit command in the console interpreter  is  called  (assuming  the
74       console interpreter has not already been deleted itself, that is.)
75

DEFAULT BINDINGS

77       The  default  script creates a console window (implemented using a text
78       widget) that has the following behaviour:
79
80       [1]    Pressing the tab key inserts a TAB character (as defined by  the
81              Tcl \t escape.)
82
83       [2]    Pressing  the return key causes the current line (if complete by
84              the rules of info complete) to be passed to the main interpreter
85              for evaluation.
86
87       [3]    Pressing  the  delete key deletes the selected text (if any text
88              is selected) or the character to the right of the cursor (if not
89              at the end of the line.)
90
91       [4]    Pressing  the  backspace  key  deletes the selected text (if any
92              text is selected) or the character to the left of the cursor (of
93              not at the start of the line.)
94
95       [5]    Pressing  either  Control+A or the home key causes the cursor to
96              go to the start of the line (but after the prompt, if  a  prompt
97              is present on the line.)
98
99       [6]    Pressing either Control+E or the end key causes the cursor to go
100              to the end of the line.
101
102       [7]    Pressing either Control+P or the  up  key  causes  the  previous
103              entry in the command history to be selected.
104
105       [8]    Pressing  either Control+N or the down key causes the next entry
106              in the command history to be selected.
107
108       [9]    Pressing either Control+B or the left key causes the  cursor  to
109              move  one character backward as long as the cursor is not at the
110              prompt.
111
112       [10]   Pressing either Control+F or the right key causes the cursor  to
113              move one character forward.
114
115       [11]   Pressing  F9  rebuilds  the console window by destroying all its
116              children and reloading the Tcl script that defined the console's
117              behaviour.
118
119       Most  other  behaviour is the same as a conventional text widget except
120       for the way that the  <<Cut>>  event  is  handled  identically  to  the
121       <<Copy>> event.
122

EXAMPLE

124       Not all platforms have the console command, so debugging code often has
125       the following code fragment in it so output produced  by  puts  can  be
126       seen while during development:
127              catch {console show}
128
129

KEYWORDS

131       console, interpreter, window, interactive, output channels
132
133

SEE ALSO

135       destroy(n),  fconfigure(n),  history(n),  interp(n),  puts(n), text(n),
136       wm(n)
137
138
139
140Tk                                    8.4                           console(n)
Impressum