Version 10 of wish

Updated 2003-08-06 09:08:30

http://tcl.tk/man/tcl8.4/UserCmd/wish.htm

wish is a simple Tcl/Tk application created during the build process of Tk. It has minimal functionality other than reading files and attempting to execute the Tcl commands inside. It does perform an implicit package require Tk as well as drop the user into an event loop.


Remember that to pass arguments to wish, like display name, etc. the arguments come after the file name to execute AND any arguments before the -- are processed by wish rather than end up in the argv list.


As mentioned in the Manual pages, when called with no filename to execute wish will call the script $(HOME)/.wishrc (under UNIX) if it exists, before dropping into an interactive shell. Under MS Windows, %HOME%/wishrc.tcl is called. So you'll need to set up an environment variable called HOME to use this feature.

Does the .wishrc get interpreted when:

  • wish is called with a file name
  • no - in this case you could use the source command in the specified script to run an initialisation script
  • when a script starts with a #! /usr/bin/wish
  • not sure - I'll check this one out. But probably not (it's like calling with a filename)
  • when tclsh is started and then a 'package require Tk is invoked?
  • I don't think so, but the tclsh has it's own RC scripts (UNIX: $(HOME)/.tclshrc; Windows: %HOME%\tclsh.rc)

I found another page about the rc files The RC File, so I guess this discussion is a little out of place - apologies. I'll move it shortly. My main point was the non-intuitive location of the rc file under Windows, rather than it's usage, which is already covered well at the above link.


Since Tcl/Tk 8.4 , it is said that wish as an application is no longer necessary; that with tclsh and a

 package require Tk 8.4

one has the complete functionality of this application.

Any comments - any exceptions, caveats, or additional lines you would recommend'to ensure the complete compatibility?

See tclsh vs. wish.


People writing scripts to be loaded from the wish command line should be aware that \u001a is an end-of-file character in scripts. I thought this was true for Tcl in general?


Category Application