version 2 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
wish |
|
|
2 |
!!!wish |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
OPTIONS |
|
|
6 |
DESCRIPTION |
|
|
7 |
OPTIONS |
|
|
8 |
APPLICATION NAME AND CLASS |
|
|
9 |
VARIABLES |
|
|
10 |
SCRIPT FILES |
|
|
11 |
PROMPTS |
|
|
12 |
KEYWORDS |
|
|
13 |
---- |
|
|
14 |
!!NAME |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
wish - Simple windowing shell |
|
|
18 |
!!SYNOPSIS |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__wish__ ?''fileName arg arg ...''? |
|
|
22 |
!!OPTIONS |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
__-colormap__ ''new'' |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
Specifies that the window should have a new private colormap |
|
|
29 |
instead of using the default colormap for the |
|
|
30 |
screen. |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
__-display__ ''display'' |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
Display (and screen) on which to display |
|
|
37 |
window. |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
__-geometry__ ''geometry'' |
|
|
41 |
|
|
|
42 |
|
|
|
43 |
Initial geometry to use for window. If this option is |
|
|
44 |
specified, its value is stored in the __geometry__ global |
|
|
45 |
variable of the application's Tcl interpreter. |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
__-name__ ''name'' Use ''name'' as the title to be |
|
|
49 |
displayed in the window, and as the name of the interpreter |
|
|
50 |
for __send__ commands. |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
__-sync__ Execute all X server commands synchronously, so |
|
|
54 |
that errors are reported immediately. This will result in |
|
|
55 |
much slower execution, but it is useful for |
|
|
56 |
debugging. |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
__-use__ ''id'' Specifies that the main window for the |
|
|
60 |
application is to be embedded in the window whose identifier |
|
|
61 |
is ''id'', instead of being created as an independent |
|
|
62 |
toplevel window. ''Id'' must be specified in the same way |
|
|
63 |
as the value for the __-use__ option for toplevel widgets |
|
|
64 |
(i.e. it has a form like that returned by the |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
__ winfo id__ command). |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
__-visual__ ''visual''Specifies the visual to use for thewindow. '' Visual'' may have any of theforms supported by the __Tk_!GetVisual__procedure.__--__ Pass all remainingarguments through to the script's __argv__variable without interpreting them.This provides a mechanism for passingarguments such as __-name__ to a scriptinstead of having __wish__ interpret them.________________________________________________________________________________________________________________________________________ |
|
|
71 |
!!DESCRIPTION |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
__Wish__ is a simple program consisting of the Tcl |
|
|
75 |
command language, the Tk toolkit, and a main program that |
|
|
76 |
reads commands from standard input or from a file. It |
|
|
77 |
creates a main window and then processes Tcl commands. If |
|
|
78 |
__wish__ is invoked with no arguments, or with a first |
|
|
79 |
argument that starts with ``-'', then it reads Tcl commands |
|
|
80 |
interactively from standard input. It will continue |
|
|
81 |
processing commands until all windows have been deleted or |
|
|
82 |
until end-of-file is reached on standard input. If there |
|
|
83 |
exists a file __.wishrc__ in the home directory of the |
|
|
84 |
user, __wish__ evaluates the file as a Tcl script just |
|
|
85 |
before reading the first command from standard |
|
|
86 |
input. |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
If __wish__ is invoked with an initial ''fileName'' |
|
|
90 |
argument, then ''fileName'' is treated as the name of a |
|
|
91 |
script file. __Wish__ will evaluate the script in |
|
|
92 |
''fileName'' (which presumably creates a user interface), |
|
|
93 |
then it will respond to events until all windows have been |
|
|
94 |
deleted. Commands will not be read from standard input. |
|
|
95 |
There is no automatic evaluation of __.wishrc__ in this |
|
|
96 |
case, but the script file can always __source__ it if |
|
|
97 |
desired. |
|
|
98 |
!!OPTIONS |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
__Wish__ automatically processes all of the command-line |
|
|
102 |
options described in the __OPTIONS__ summary above. Any |
|
|
103 |
other command-line arguments besides these are passed |
|
|
104 |
through to the application using the __argc__ and |
|
|
105 |
__argv__ variables described later. |
|
|
106 |
!!APPLICATION NAME AND CLASS |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
The name of the application, which is used for purposes such |
|
|
110 |
as __send__ commands, is taken from the __-name__ |
|
|
111 |
option, if it is specified; otherwise it is taken from |
|
|
112 |
''fileName'', if it is specified, or from the command |
|
|
113 |
name by which __wish__ was invoked. In the last two |
|
|
114 |
cases, if the name contains a ``/'' character, then only the |
|
|
115 |
characters after the last slash are used as the application |
|
|
116 |
name. |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
The class of the application, which is used for purposes |
|
|
120 |
such as specifying options with a __RESOURCE_MANAGER__ |
|
|
121 |
property or .Xdefaults file, is the same as its name except |
|
|
122 |
that the first letter is capitalized. |
|
|
123 |
!!VARIABLES |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
__Wish__ sets the following Tcl variables: |
|
|
127 |
|
|
|
128 |
|
|
|
129 |
__argc__ Contains a count of the number of ''arg'' |
|
|
130 |
arguments (0 if none), not including the options described |
|
|
131 |
above. |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
__argv__ Contains a Tcl list whose elements are the |
|
|
135 |
''arg'' arguments that follow a __--__ option or don't |
|
|
136 |
match any of the options described in OPTIONS above, in |
|
|
137 |
order, or an empty string if there are no such |
|
|
138 |
arguments. |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
__argv0__ Contains ''fileName'' if it was specified. |
|
|
142 |
Otherwise, contains the name by which __wish__ was |
|
|
143 |
invoked. |
|
|
144 |
|
|
|
145 |
|
|
|
146 |
__geometry__ |
|
|
147 |
|
|
|
148 |
|
|
|
149 |
If the __-geometry__ option is specified, __wish__ |
|
|
150 |
copies its value into this variable. If the variable still |
|
|
151 |
exists after ''fileName'' has been evaluated, __wish__ |
|
|
152 |
uses the value of the variable in a __wm geometry__ |
|
|
153 |
command to set the main window's geometry. |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
__tcl_interactive__ |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
Contains 1 if __wish__ is reading commands interactively |
|
|
160 |
(''fileName'' was not specified and standard input is a |
|
|
161 |
terminal-like device), 0 otherwise. |
|
|
162 |
!!SCRIPT FILES |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
If you create a Tcl script in a file whose first line |
|
|
166 |
is |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
__#!/usr/local/bin/wish |
|
|
170 |
__ |
|
|
171 |
|
|
|
172 |
|
|
|
173 |
then you can invoke the script file directly from your shell |
|
|
174 |
if you mark it as executable. This assumes that __wish__ |
|
|
175 |
has been installed in the default location in |
|
|
176 |
/usr/local/bin; if it's installed somewhere else then you'll |
|
|
177 |
have to modify the above line to match. Many UNIX systems do |
|
|
178 |
not allow the __#!__ line to exceed about 30 characters |
|
|
179 |
in length, so be sure that the __wish__ executable can be |
|
|
180 |
accessed with a short file name. |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
An even better approach is to start your script files with |
|
|
184 |
the following three lines: |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
__#!/bin/sh |
|
|
188 |
# the next line restarts using wish \ |
|
|
189 |
exec wish |
|
|
190 |
__ |
|
|
191 |
|
|
|
192 |
|
|
|
193 |
This approach has three advantages over the approach in the |
|
|
194 |
previous paragraph. First, the location of the __wish__ |
|
|
195 |
binary doesn't have to be hard-wired into the script: it can |
|
|
196 |
be anywhere in your shell search path. Second, it gets |
|
|
197 |
around the 30-character file name limit in the previous |
|
|
198 |
approach. Third, this approach will work even if __wish__ |
|
|
199 |
is itself a shell script (this is done on some systems in |
|
|
200 |
order to handle multiple architectures or operating systems: |
|
|
201 |
the __wish__ script selects one of several binaries to |
|
|
202 |
run). The three lines cause both __sh__ and __wish__ |
|
|
203 |
to process the script, but the __exec__ is only executed |
|
|
204 |
by __sh__. __sh__ processes the script first; it |
|
|
205 |
treats the second line as a comment and executes the third |
|
|
206 |
line. The __exec__ statement cause the shell to stop |
|
|
207 |
processing and instead to start up __wish__ to reprocess |
|
|
208 |
the entire script. When __wish__ starts up, it treats all |
|
|
209 |
three lines as comments, since the backslash at the end of |
|
|
210 |
the second line causes the third line to be treated as part |
|
|
211 |
of the comment on the second line. |
|
|
212 |
!!PROMPTS |
|
|
213 |
|
|
|
214 |
|
|
|
215 |
When __wish__ is invoked interactively it normally |
|
|
216 |
prompts for each command with ``__%__ ''. You can change |
|
|
217 |
the prompt by setting the variables __tcl_prompt1__ and |
|
|
218 |
__tcl_prompt2__. If variable __tcl_prompt1__ exists |
|
|
219 |
then it must consist of a Tcl script to output a prompt; |
|
|
220 |
instead of outputting a prompt __wish__ will evaluate the |
|
|
221 |
script in __tcl_prompt1__. The variable |
|
|
222 |
__tcl_prompt2__ is used in a similar way when a newline |
|
|
223 |
is typed but the current command isn't yet complete; if |
|
|
224 |
__tcl_prompt2__ isn't set then no prompt is output for |
|
|
225 |
incomplete commands. |
|
|
226 |
!!KEYWORDS |
|
|
227 |
|
|
|
228 |
|
|
|
229 |
shell, toolkit |
|
|
230 |
---- |