Version 8 of Microsoft Windows and Tk

Updated 2002-05-29 16:11:41

Purpose: Provide a collection of hints for making Tk more convenient on Microsoft Windows.

  • If you write to stdout or stderr, and haven't redirected your standard channels, you are writing into the Windows Wish Console whether you know it or not! Once you get more than a few hundred lines of output into it, the Wish console gets very slow; visit the page referenced above to see how to take care of it.
  • The care and feeding of the system menu is discussed in menu.
  • Windows Wish Console has some tricks for dealing with the Tk console on the Windows platform. The menu page shows how to add a Show Console item to the system menu.
  • (KBK 8 January 2001) The Wish console can also be used from within C++ code; Cplusplus streams and Tcl channels shows how.
  • Printing a canvas under Windows shows one way to get printout from the canvas on Windows.
  • There are various hints on running DDE, on a page called, predictably enough, dde.
  • Example of using the registry package can be found at Windows Registry Browser
  • Invoking browsers shows how to launch a Web browser under control of a Tcl script.
  • There is a collection of hints on how to deal with a serial port.
  • Bag of algorithms has help in dealing with the Windows file system, including how to test if a drive has media in it, how to tot up the free space on a drive, and how to deal with variant line terminators (CR/LF vs. LF only).
  • TEA includes a discussion of how to build a native-code extension on Windows using Visual C++. (Alas, it's an embarrassment to the Windows using portion of the Tcl community! Hopefully someone who programs in this area steps forward to assist in improving the situation.)
  • Text widget contents, even with exotic Unicodes, can be printed on WinNT by copying and pasting into a Notepad, provided you have a Unicode font like Bitstream Cyberbit (recent Microsoft fonts also support Greek, Russian, Arabic, Hebrew), and have set Notepad to use that. The "higher" editors like Wordpad and Word don't accept exotic text pasting so easy, since they refer to an explicit font setup that also includes the language. RS
  • An installation program will often want to Register file types under Windows so that users can invoke a Tcl script on a file by double-clicking the file.
  • If a Tk app pops up a fileselector dialog at its beginning, the main window may not react to clicks or keys even if it seems to be in focus. A (on Unix redundant) update before the fileselector command fixed that. - RS
  • tk_chooseDirectory on Windows can be annoying by return all file names in full caps. An improved tk_chooseDirectory winChooseDirectory corrects this. Hopefully this will be resolved in 8.4. -TFW
  • For finer control of the "launch conditions" of process spawning, use start.
  • Tk can fake the little thingy with three diagonal lines that lives at the lower right corner and lets you resize a window. Resize control shows how.

What if you want "to go the other way", and, for example, "Give Unix a Windows look and feel"? There's a Wiki page for that, too.


Interesting note - recently someone on comp.lang.tcl reported that a Hewlett Packard Pavillion, running Windows XP, came with Tcl installed. Another user reports that Morton Kern Systems MKS Toolkit - a package of Unix-like utilities for Windows, comes with Tcl/Tk (along with Perl, awk, etc.). Jeff Hobbes mentioned that Microsoft's Interix toolkit comes with Tcl along with 'a ton' of other "unix" utilities. And of course Cygnus comes with a version of Tcl/Tk (and there are users which provide newer versions of Tcl/Tk/other extensions for Cygnus).


See also Microsoft Windows and Tcl - Windows/CE - Windows: getting desktop properties


Arts and crafts of Tcl-Tk programming