[R] Off topic: Tcl/Tk outside R.

Rolf Turner r.turner at auckland.ac.nz
Mon Jul 14 03:57:41 CEST 2008


I'm trying to learn about the tcltk package and its uses.  Floundering
around a bit ... Have discovered Peter Dalgaard's articles in R-News,
which should help.  Also James Wettenhall's suite of examples look like
they might be enlightening, even though the indications are that they  
are
Windoze oriented.

Be that as it were, I decided to fool around a bit with Tcl/Tk *outside*
of R to see if I could get the hang of just what Tcl/Tk actually is.
(As I said I am floundering; I can't seem to get a conceptual grip on
what it's all about.)  I discovered a Tcl/Tk ``Cookbook'' by Sastry
and Sastry that looked promising.  URL:

	http://www.dci.clrc.ac.uk/Publications/Cookbook/

Tried the first couple of (ultra-simple) examples and they seemed to  
work.
(Amazing, for me.)

Then I tried the example on creating an executable file for invoking
the Tcl/Tk commands.  The instructions said to create a file
``button.tcl'' with a first line

#!/usr/bin/wish

and succeeding lines

button .b -text "Press Me" -command exit
pack .b

I did this, did a chmod to make the file executable, and then typed

button.tcl

at the command line prompt.  I got the error messages

tcsh: button: Command not found.
tcsh: pack: Command not found.

So the code at the beginning of the script telling the machine
to use the ``wi'' shell (rather than tcsh) is being ignored.
Why?

The Tcl/Tk executables really are in /usr/bin.

If I invoke ``wish'' interactively, and then type in the ``succeeding  
lines''
interactively the ``Press Me'' button pops up as it should.  (And  
goes away
when I click on it.)

Also if I type ``wish button.tcl'' then it seems to work; i.e. the  
button
pops up and goes away when clicked.

Can anyone give me a hint as to why it doesn't work when the the  
executable
script is invoked directly (from tcsh)?  Other than the fact that I'm
using a Mac :-) .

[Invoking unname -a gives ``Darwin TURNER-ROLF.local 8.11.1 Darwin  
Kernel
Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/ 
RELEASE_I386 i386 i386''.]

The Tcl/Tk software, from what I can glean, appears to be version 8.4  
(???).

Thanks for any insights.

		cheers,

			Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list