[R] tcltk extension: documentation?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Nov 28 18:09:31 CET 2003


Dirk Eddelbuettel <edd at debian.org> writes:

> On Fri, Nov 28, 2003 at 09:25:40AM -0600, Dirk Eddelbuettel wrote:
> > 
> > Luca,
> > 
> > On Fri, Nov 28, 2003 at 10:32:47AM +0100, Luca Paglieri wrote:
> > > Hi all,
> > > 	i'm searching for a tutorial on the tcltk extension to R. I've 
> > > looked at the pages linked to the R web site, and found the examples 
> > > extremely useful, but I'd like something more.
> > > Does anyone know about other documents regarding this subject?
> > 
> > Couple of points:
> > 
> > i)   There are two R News articles you should read.  Not all of their examples
> >      work "as is", but it will give a rather nice introduction that should help
> >      you understand the framework. The second article also explained what 
> >      changed in the R / tcltk interaction, and why. 
> 
> PS 1:  Sorry, I meant not all examples from the first article work as is.
>        IIRC they will for the second one.

I think so, although a couple of things have changed since. The second
article also explains why the examples in the first one stopped
working. 
     
> > ii)  Read and try to modify the examples and the demos in the tcltk package
> >      itself. 
> > 
> > iii) Look at James Wettenhall's excellent 'cookbook' website at
> >      http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/

Yup. Be suspicious of any calls to paste() though. AFAIR, there used
to be a lot more of those which James has cleaned up since, but there
are still a few left. E.g. (from the page about menus),

copyText <- function()
.Tcl(paste("event","generate",.Tcl.args(.Tk.ID(txt),"<<Copy>>")))

I think that wants to be

copyText <- function() tkcmd("event", "generate", txt, "<<Copy>>")

[Untested, however...]
 
> > vi)  Lastly, use some other *tk documentation.  I find the 2nd edition of the
> >      Perl/Tk book by O'Reilly quite helpful for an overview of what is 
> >      available, as well as short examples.

My favourite here is Brent Welch's book. Not cheap (by computer
standards -- compared to stats books it is a steal!), but very
comprehensive. Most importantly it is one of those books which by some
sort of magic can answer your questions without actually putting it in
writing anywhere: For instance, I went looking for a recipe of how to
bind a keystroke event to an image and couldn't find one; however, I
did see sufficiently many references to "Keyboard focus" that it
dawned on me that images are put in labels and labels just don't get
keyboard focus (at least not without further ado)....

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list