/help/02TclTk8.4/UserCmd/wish.htm
HTML | 206 lines | 201 code | 5 blank | 0 comment | 0 complexity | 407ceaedfac8969a36305dc636efe8b1 MD5 | raw file
Possible License(s): AGPL-3.0
- <HTML><HEAD><TITLE>Tk Applications - wish manual page</TITLE></HEAD><BODY>
- <DL>
- <DD><A HREF="wish.htm#M2" NAME="L15">NAME</A>
- <DL><DD>wish - Simple windowing shell</DL>
- <DD><A HREF="wish.htm#M3" NAME="L16">SYNOPSIS</A>
- <DL>
- <DD><B>wish</B> ?<I>fileName arg arg ...</I>?
- </DL>
- <DD><A HREF="wish.htm#M4" NAME="L17">OPTIONS</A>
- <DL>
- <DD><A HREF="wish.htm#M5" NAME="L18"><B>-colormap </B><I>new</I></A>
- <DD><A HREF="wish.htm#M6" NAME="L19"><B>-display </B><I>display</I></A>
- <DD><A HREF="wish.htm#M7" NAME="L20"><B>-geometry </B><I>geometry</I></A>
- <DD><A HREF="wish.htm#M8" NAME="L21"><B>-name </B><I>name</I></A>
- <DD><A HREF="wish.htm#M9" NAME="L22"><B>-sync</B></A>
- <DD><A HREF="wish.htm#M10" NAME="L23"><B>-use</B> <I>id</I></A>
- <DD><A HREF="wish.htm#M11" NAME="L24"><B>-visual </B><I>visual</I></A>
- <DD><A HREF="wish.htm#M12" NAME="L25"><B>- -</B></A>
- </DL>
- <DD><A HREF="wish.htm#M13" NAME="L26">DESCRIPTION</A>
- <DD><A HREF="wish.htm#M14" NAME="L27">OPTIONS</A>
- <DD><A HREF="wish.htm#M15" NAME="L28">APPLICATION NAME AND CLASS</A>
- <DD><A HREF="wish.htm#M16" NAME="L29">VARIABLES</A>
- <DL>
- <DD><A HREF="wish.htm#M17" NAME="L30"><B>argc</B></A>
- <DD><A HREF="wish.htm#M18" NAME="L31"><B>argv</B></A>
- <DD><A HREF="wish.htm#M19" NAME="L32"><B>argv0</B></A>
- <DD><A HREF="wish.htm#M20" NAME="L33"><B>geometry</B></A>
- <DD><A HREF="wish.htm#M21" NAME="L34"><B>tcl_interactive</B></A>
- </DL>
- <DD><A HREF="wish.htm#M22" NAME="L35">SCRIPT FILES</A>
- <DD><A HREF="wish.htm#M23" NAME="L36">PROMPTS</A>
- <DD><A HREF="wish.htm#M24" NAME="L37">KEYWORDS</A>
- </DL><HR>
- <H3><A NAME="M2">NAME</A></H3>
- wish - Simple windowing shell
- <H3><A NAME="M3">SYNOPSIS</A></H3>
- <B>wish</B> ?<I>fileName arg arg ...</I>?<BR>
- <H3><A NAME="M4">OPTIONS</A></H3>
- <DL>
- <P><DT><A NAME="M5"><B>-colormap </B><I>new</I></A><DD>
- Specifies that the window should have a new private colormap instead of
- using the default colormap for the screen.
- <P><DT><A NAME="M6"><B>-display </B><I>display</I></A><DD>
- Display (and screen) on which to display window.
- <P><DT><A NAME="M7"><B>-geometry </B><I>geometry</I></A><DD>
- Initial geometry to use for window. If this option is specified, its
- value is stored in the <B>geometry</B> global variable of the application's
- Tcl interpreter.
- <P><DT><A NAME="M8"><B>-name </B><I>name</I></A><DD>
- Use <I>name</I> as the title to be displayed in the window, and
- as the name of the interpreter for <B><A HREF="../TkCmd/send.htm">send</A></B> commands.
- <P><DT><A NAME="M9"><B>-sync</B></A><DD>
- Execute all X server commands synchronously, so that errors
- are reported immediately. This will result in much slower
- execution, but it is useful for debugging.
- <P><DT><A NAME="M10"><B>-use</B> <I>id</I></A><DD>
- Specifies that the main window for the application is to be embedded in
- the window whose identifier is <I>id</I>, instead of being created as an
- independent toplevel window. <I>Id</I> must be specified in the same
- way as the value for the <B>-use</B> option for toplevel widgets (i.e.
- it has a form like that returned by the <B><A HREF="../TkCmd/winfo.htm">winfo id</A></B> command).
- <P><DT><A NAME="M11"><B>-visual </B><I>visual</I></A><DD>
- Specifies the visual to use for the window.
- <I>Visual</I> may have any of the forms supported by the <B><A HREF="../TkLib/GetVisual.htm">Tk_GetVisual</A></B>
- procedure.
- <P><DT><A NAME="M12"><B>- -</B></A><DD>
- Pass all remaining arguments through to the script's <B>argv</B>
- variable without interpreting them.
- This provides a mechanism for passing arguments such as <B>-name</B>
- to a script instead of having <B>wish</B> interpret them.
- <P></DL>
- <H3><A NAME="M13">DESCRIPTION</A></H3>
- <B>Wish</B> is a simple program consisting of the Tcl command
- language, the Tk toolkit, and a main program that reads commands
- from standard input or from a file.
- It creates a main window and then processes Tcl commands.
- If <B>wish</B> is invoked with no arguments, or with a first argument
- that starts with ``-'', then it reads Tcl commands interactively from
- standard input.
- It will continue processing commands until all windows have been
- deleted or until end-of-file is reached on standard input.
- If there exists a file <B>.wishrc</B> in the home directory of
- the user, <B>wish</B> evaluates the file as a Tcl script
- just before reading the first command from standard input.
- <P>
- If <B>wish</B> is invoked with an initial <I>fileName</I> argument, then
- <I>fileName</I> is treated as the name of a script file.
- <B>Wish</B> will evaluate the script in <I>fileName</I> (which
- presumably creates a user interface), then it will respond to events
- until all windows have been deleted.
- Commands will not be read from standard input.
- There is no automatic evaluation of <B>.wishrc</B> when the name
- of a script file is presented on the <B>wish</B> command line,
- but the script file can always <B><A HREF="../TclCmd/source.htm">source</A></B> it if desired.
- <H3><A NAME="M14">OPTIONS</A></H3>
- <B>Wish</B> automatically processes all of the command-line options
- described in the <B><A HREF="../TkCmd/options.htm">OPTIONS</A></B> summary above.
- Any other command-line arguments besides these are passed through
- to the application using the <B>argc</B> and <B>argv</B> variables
- described later.
- <H3><A NAME="M15">APPLICATION NAME AND CLASS</A></H3>
- The name of the application, which is used for purposes such as
- <B><A HREF="../TkCmd/send.htm">send</A></B> commands, is taken from the <B>-name</B> option,
- if it is specified; otherwise it is taken from <I>fileName</I>,
- if it is specified, or from the command name by which
- <B>wish</B> was invoked. In the last two cases, if the name contains a ``/''
- character, then only the characters after the last slash are used
- as the application name.
- <P>
- The class of the application, which is used for purposes such as
- specifying options with a <B>RESOURCE_MANAGER</B> property or .Xdefaults
- file, is the same as its name except that the first letter is
- capitalized.
- <H3><A NAME="M16">VARIABLES</A></H3>
- <B>Wish</B> sets the following Tcl variables:
- <P>
- <DL>
- <P><DT><A NAME="M17"><B>argc</B></A><DD>
- Contains a count of the number of <I>arg</I> arguments (0 if none),
- not including the options described above.
- <P><DT><A NAME="M18"><B>argv</B></A><DD>
- Contains a Tcl list whose elements are the <I>arg</I> arguments
- that follow a <B>- -</B> option or don't match any of the
- options described in OPTIONS above, in order, or an empty string
- if there are no such arguments.
- <P><DT><A NAME="M19"><B>argv0</B></A><DD>
- Contains <I>fileName</I> if it was specified.
- Otherwise, contains the name by which <B>wish</B> was invoked.
- <P><DT><A NAME="M20"><B>geometry</B></A><DD>
- If the <B>-geometry</B> option is specified, <B>wish</B> copies its
- value into this variable. If the variable still exists after
- <I>fileName</I> has been evaluated, <B>wish</B> uses the value of
- the variable in a <B><A HREF="../TkCmd/wm.htm">wm geometry</A></B> command to set the main
- window's geometry.
- <P><DT><A NAME="M21"><B>tcl_interactive</B></A><DD>
- Contains 1 if <B>wish</B> is reading commands interactively (<I>fileName</I>
- was not specified and standard input is a terminal-like
- device), 0 otherwise.
- <P></DL>
- <H3><A NAME="M22">SCRIPT FILES</A></H3>
- If you create a Tcl script in a file whose first line is
- <PRE><B>#!/usr/local/bin/wish</B></PRE>
- then you can invoke the script file directly from your shell if
- you mark it as executable.
- This assumes that <B>wish</B> has been installed in the default
- location in /usr/local/bin; if it's installed somewhere else
- then you'll have to modify the above line to match.
- Many UNIX systems do not allow the <B>#!</B> line to exceed about
- 30 characters in length, so be sure that the <B>wish</B> executable
- can be accessed with a short file name.
- <P>
- An even better approach is to start your script files with the
- following three lines:
- <PRE><B>#!/bin/sh
- # the next line restarts using wish \
- exec wish "$0" "$@"</B></PRE>
- This approach has three advantages over the approach in the previous
- paragraph. First, the location of the <B>wish</B> binary doesn't have
- to be hard-wired into the script: it can be anywhere in your shell
- search path. Second, it gets around the 30-character file name limit
- in the previous approach.
- Third, this approach will work even if <B>wish</B> is
- itself a shell script (this is done on some systems in order to
- handle multiple architectures or operating systems: the <B>wish</B>
- script selects one of several binaries to run). The three lines
- cause both <B>sh</B> and <B>wish</B> to process the script, but the
- <B><A HREF="../TclCmd/exec.htm">exec</A></B> is only executed by <B>sh</B>.
- <B>sh</B> processes the script first; it treats the second
- line as a comment and executes the third line.
- The <B><A HREF="../TclCmd/exec.htm">exec</A></B> statement cause the shell to stop processing and
- instead to start up <B>wish</B> to reprocess the entire script.
- When <B>wish</B> starts up, it treats all three lines as comments,
- since the backslash at the end of the second line causes the third
- line to be treated as part of the comment on the second line.
- <P>
- The end of a script file may be marked either by the physical end of
- the medium, or by the character, '\032' ('\u001a', control-Z).
- If this character is present in the file, the <B>wish</B> application
- will read text up to but not including the character. An application
- that requires this character in the file may encode it as
- ``\032'', ``\x1a'', or ``\u001a''; or may generate it by use of commands
- such as <B><A HREF="../TclCmd/format.htm">format</A></B> or <B><A HREF="../TclCmd/binary.htm">binary</A></B>.
- <H3><A NAME="M23">PROMPTS</A></H3>
- When <B>wish</B> is invoked interactively it normally prompts for each
- command with ``<B>% </B>''. You can change the prompt by setting the
- variables <B>tcl_prompt1</B> and <B>tcl_prompt2</B>. If variable
- <B>tcl_prompt1</B> exists then it must consist of a Tcl script
- to output a prompt; instead of outputting a prompt <B>wish</B>
- will evaluate the script in <B>tcl_prompt1</B>.
- The variable <B>tcl_prompt2</B> is used in a similar way when
- a newline is typed but the current command isn't yet complete;
- if <B>tcl_prompt2</B> isn't set then no prompt is output for
- incomplete commands.
- <H3><A NAME="M24">KEYWORDS</A></H3>
- <A href="../Keywords/S.htm#shell">shell</A>, <A href="../Keywords/T.htm#toolkit">toolkit</A>
- <HR><PRE>
- <A HREF="../copyright.htm">Copyright</A> © 1991-1994 The Regents of the University of California.
- <A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc.
- <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE>
- </BODY></HTML>