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

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Mon, 14 Jul 2008 13:57:41 +1200

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}}

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 Jul 2008 - 02:03:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Jul 2008 - 07:32:47 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive