wish

https://www.tcl-lang.org/man/tcl8.5/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.


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. Read more about this on The RC File page.


Since any newer version of Tcl/Tk (guess 8.5.7), the default font in wish may look quite uncommon, at least in Windows XP. The cause is in this line in ...\tcl\lib\tk8.5\console.tcl

        win32 { set preferred {ProFontWindows 10 Consolas 8} }

Consolas 8 is introduced with Windows Vista. ProFontWindows seems a certain third-party-font. Outcommenting this line yields the familiar Courier New font as present in former wish editions.

AMG: ProFontWindows can be found here: [L1 ]. It's a very nice font, although I'm quite surprised that it's referenced by the Tk library.

Update (19 Mar 2019): tobias-jung.de (website linked above) is down, saying "For technical reasons, we had to temporarily take the site off the grid. Do not worry, we'll be back soon - hopefully around mid-June 2018." If anyone is interested, I might be able to share my own copy of ProFontWindows.


escargo 2016-07-08: Is there any way to control the size of the wish console? I'm trying to run wish on the PocketC.H.I.P., which has a small screen. https://www.nextthing.co/pages/pocketchip

It's so small that starting wish completely fills its tiny screen. If I could trim it down somehow, then I might be able to do development on the PocketCHIP itself. Failing that, I might need to build applications elsewhere and transfer the files to the PocketCHIP to run and test.

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.

"What are the differences between wish and wish84?"

Questions :

  • Does the .wishrc script get interpreted when when tclsh is started and then a 'package require Tk is invoked?
  • No. Setting the tcl_rcFileName to ~/wishrc is a property of wish, the application, not Tk, the package. By the time any [package require Tk] command got evaluated, the resource file for tclsh would have already been sourced anyway.
  • When starting a script with "package require Tk" using tclsh, a console window opens. How do you get rid of this console ("console hide" does not work) ?

LV Recently I ran across a program which had the following coded:

#! /path/to/wish -f

I don't see any reference to a -f flag in wish.1 from Tk 7 through 8.5. Is this an old flag that used to be available? Or is it something that just isn't documented in the man page?


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?