Why people still like TCL/TK
This is the complete source code for a little X program I call tkmsg
.
It puts up a window with a text message (given as the command line
arguments, ala echo
), sized to fit the message, and when you click in
the window it goes away.
set myname "tkmsg" wm title . $myname wm iconname . $myname frame .frame button .text -text $argv -command {exit} pack .text
(And this also automatically handles standard X things like the
-geometry
command line argument.)
For all its warts, TCL/TK is pretty much the closest the Unix world has come to a Bourne shell for X programming: something you can use to easily whip up quick little utilities and scripts. And it's pretty good at that job, as you can see.
(And like sh scripts, it can be written by people who are just
bashing rocks together; you don't have to choke down a big pile
of library documentation just to do something simple. The most
time consuming bit of writing this script was finding out how
to print out stuff to standard output, so I could see if TK did
anything peculiar to $argv
or if I could just use is straight.)
|
|