Updated 2011-07-26 03:58:57 by RLE

Richard Suchenwirth 2004-03-05 - I think there is no smaller useful Tcl/Tk program possible than this:
 pack [text .t]

As it's just three words long, we might discuss them one by one:

  • text creates a text widget, with all its bindings and features
  • .t is the name I give to this widget (I like minimal things, and the initial of the widget class is short and clear)
  • pack calls a geometry manager to make the widget appear on screen

And how is this useful? Well, just today I had to paste a string from a cmd window into a buffer, edit the backslashes to slashes (and remove linefeeds), and then paste it back into a Cygwin window. Most easily done with a text scratchpad just like this... Another use case: Copying pre-formatted text directly from the MS Internet Explorer into an editor may make it lose its line breaks. Copy it into this window first, then mark it again, and copy on - line breaks have been preserved now.

You could start more instances of this "program", and use them to organize your thoughts, by copying between them.

Modern usage requires that scripts all start in a tclsh, and announce what they need (Tk in this case). This makes the program double as long:
 package require Tk
 pack [text .t]

Another refinement allows to resize the window with the mouse:
 package require Tk
 pack [text .t] -fill both -expand 1

And for real usability (including loading and saving files), you might check A minimal editor...