[R] How to use tcltk?

Thomas Lumley thomas at biostat.washington.edu
Wed Jul 19 17:39:25 CEST 2000


On Wed, 19 Jul 2000, Peter Wolf wrote:

> 
> Hallo Tk experts,

I'm not sure you'll find many of them here :)
 

> Is there a pool of well designed applications of tk functions? /
No

> Have you created a beautiful example?
No (well, yes, but you've seen it)

> Here is one of my problems: To print the position of the mouse cursor
> the following lines of code will work:
> 
>   label .l2 -textvariable tvar
>   pack  .l2
>   bind  .    <Motion> { set tvar "position %x %y" }
>   bind  .    <Leave>  { set tvar "mouse outside"  }
> 
> However, I have not been able to implement this by tk* functions of the R
> package. Any idea?

It seems to translate fairly easily (and I don't really know Tcl/Tk)

tt<-tktoplevel()
l2<-tklabel(tt,textvariable="tvar")
tkpack(l2)
tkbind(tt,"<Motion>","set tvar \"position %x %y\"")
tkbind(tt,"<Leave>","set tvar \"mouse outside\"")

and if you like you can also read or set tvar from R using tclvar$tvar

	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list