1wish(1) Tk Applications wish(1)
2
3
4
5______________________________________________________________________________
6
8 wish - Simple windowing shell
9
11 wish ?fileName arg arg ...?
12
14 -colormap new Specifies that the window should have a new private
15 colormap instead of using the default colormap for
16 the screen.
17
18 -display display Display (and screen) on which to display window.
19
20 -geometry geometry Initial geometry to use for window. If this option
21 is specified, its value is stored in the geometry
22 global variable of the application's Tcl inter‐
23 preter.
24
25 -name name Use name as the title to be displayed in the win‐
26 dow, and as the name of the interpreter for send
27 commands.
28
29 -sync Execute all X server commands synchronously, so
30 that errors are reported immediately. This will
31 result in much slower execution, but it is useful
32 for debugging.
33
34 -use id │
35 Specifies that the main window for the application │
36 is to be embedded in the window whose identifier is │
37 id, instead of being created as an independent │
38 toplevel window. Id must be specified in the same │
39 way as the value for the -use option for toplevel │
40 widgets (i.e. it has a form like that returned by │
41 the winfo id command).
42
43 -visual visual Specifies the visual to use for the window. Visual
44 may have any of the forms supported by the
45 Tk_GetVisual procedure.
46
47 -- Pass all remaining arguments through to the
48 script's argv variable without interpreting them.
49 This provides a mechanism for passing arguments
50 such as -name to a script instead of having wish
51 interpret them.
52_________________________________________________________________
53
54
56 Wish is a simple program consisting of the Tcl command language, the Tk
57 toolkit, and a main program that reads commands from standard input or
58 from a file. It creates a main window and then processes Tcl commands.
59 If wish is invoked with no arguments, or with a first argument that
60 starts with ``-'', then it reads Tcl commands interactively from stan‐
61 dard input. It will continue processing commands until all windows
62 have been deleted or until end-of-file is reached on standard input.
63 If there exists a file .wishrc in the home directory of the user, wish
64 evaluates the file as a Tcl script just before reading the first com‐
65 mand from standard input.
66
67 If wish is invoked with an initial fileName argument, then fileName is
68 treated as the name of a script file. Wish will evaluate the script in
69 fileName (which presumably creates a user interface), then it will
70 respond to events until all windows have been deleted. Commands will
71 not be read from standard input. There is no automatic evaluation of
72 .wishrc when the name of a script file is presented on the wish command
73 line, but the script file can always source it if desired.
74
75
77 Wish automatically processes all of the command-line options described
78 in the OPTIONS summary above. Any other command-line arguments besides
79 these are passed through to the application using the argc and argv
80 variables described later.
81
82
84 The name of the application, which is used for purposes such as send
85 commands, is taken from the -name option, if it is specified; other‐
86 wise it is taken from fileName, if it is specified, or from the command
87 name by which wish was invoked. In the last two cases, if the name
88 contains a ``/'' character, then only the characters after the last
89 slash are used as the application name.
90
91 The class of the application, which is used for purposes such as speci‐
92 fying options with a RESOURCE_MANAGER property or .Xdefaults file, is
93 the same as its name except that the first letter is capitalized.
94
95
97 Wish sets the following Tcl variables:
98
99 argc Contains a count of the number of arg arguments (0 if
100 none), not including the options described above.
101
102 argv Contains a Tcl list whose elements are the arg arguments
103 that follow a -- option or don't match any of the
104 options described in OPTIONS above, in order, or an
105 empty string if there are no such arguments.
106
107 argv0 Contains fileName if it was specified. Otherwise, con‐
108 tains the name by which wish was invoked.
109
110 geometry If the -geometry option is specified, wish copies its
111 value into this variable. If the variable still exists
112 after fileName has been evaluated, wish uses the value
113 of the variable in a wm geometry command to set the main
114 window's geometry.
115
116 tcl_interactive
117 Contains 1 if wish is reading commands interactively
118 (fileName was not specified and standard input is a ter‐
119 minal-like device), 0 otherwise.
120
121
123 If you create a Tcl script in a file whose first line is
124 #!/usr/local/bin/wish
125 then you can invoke the script file directly from your shell if you
126 mark it as executable. This assumes that wish has been installed in
127 the default location in /usr/local/bin; if it's installed somewhere
128 else then you'll have to modify the above line to match. Many UNIX
129 systems do not allow the #! line to exceed about 30 characters in
130 length, so be sure that the wish executable can be accessed with a
131 short file name.
132
133 An even better approach is to start your script files with the follow‐
134 ing three lines:
135 #!/bin/sh
136 # the next line restarts using wish \
137 exec wish "$0" "$@"
138 This approach has three advantages over the approach in the previous
139 paragraph. First, the location of the wish binary doesn't have to be
140 hard-wired into the script: it can be anywhere in your shell search
141 path. Second, it gets around the 30-character file name limit in the
142 previous approach. Third, this approach will work even if wish is
143 itself a shell script (this is done on some systems in order to handle
144 multiple architectures or operating systems: the wish script selects
145 one of several binaries to run). The three lines cause both sh and
146 wish to process the script, but the exec is only executed by sh. sh
147 processes the script first; it treats the second line as a comment and
148 executes the third line. The exec statement cause the shell to stop
149 processing and instead to start up wish to reprocess the entire script.
150 When wish starts up, it treats all three lines as comments, since the
151 backslash at the end of the second line causes the third line to be
152 treated as part of the comment on the second line.
153
154 The end of a script file may be marked either by the physical end of │
155 the medium, or by the character, '\032' ('\u001a', control-Z). If this │
156 character is present in the file, the wish application will read text │
157 up to but not including the character. An application that requires │
158 this character in the file may encode it as ``\032'', ``\x1a'', or │
159 ``\u001a''; or may generate it by use of commands such as format or │
160 binary.
161
163 When wish is invoked interactively it normally prompts for each command
164 with ``% ''. You can change the prompt by setting the variables
165 tcl_prompt1 and tcl_prompt2. If variable tcl_prompt1 exists then it
166 must consist of a Tcl script to output a prompt; instead of outputting
167 a prompt wish will evaluate the script in tcl_prompt1. The variable
168 tcl_prompt2 is used in a similar way when a newline is typed but the
169 current command isn't yet complete; if tcl_prompt2 isn't set then no
170 prompt is output for incomplete commands.
171
172
174 shell, toolkit
175
176
177
178Tk 8.0 wish(1)