[R] tcltk - text widget with a scrollbar?
Michael A. Miller
mmiller3 at iupui.edu
Tue Aug 13 20:03:29 CEST 2002
>>>>> "John" == John Zhang <jzhang at jimmy.harvard.edu> writes:
> The following code should work:
> library(tcltk)
> top <- tktoplevel()
> mytext <- tktext(top)
> myscr <- tkscrollbar(top, command = function (...) tkyview(...))
> tkconfigure(mytext, yscrollcommand = function(...) tkset(myscr, ...))
> tkpack(myscr, side = "right", fill = "y")
> tkpack(mytext, fill = "both", expand = TRUE)
Thanks John,
That almost works. When I run your code and populate the text
widget with
for ( i in seq(100) ) {
tkinsert(mytext,'end', paste(i,'lots of text\n'))
}
I can scroll around in the widget with my scroll mouse, but using
the mouse on the scroll bar slider produces this sort of error:
Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") :
[tcl] invalid command name "moveto".
Mousing on the other parts of the scroll bar produces this error:
Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") :
[tcl] invalid command name "moveto".
Mike
P.S. Here's my version info:
R.version
_
platform i386-pc-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 1
minor 5.1
year 2002
month 06
day 17
language R
> library(help=tcltk)
tcltk Interface to Tcl/Tk
Description:
Package: tcltk
Version: 1.5.1
Priority: base
Title: Tcl/Tk Interface
Author: R Development Core Team
Maintainer: R Core Team <R-core at r-project.org>
Description: Interface and Language Bindings to Tcl/Tk GUI elements
License: GPL Version 2 or later.
I get the same error messages when I try this with a windows R:
> R.version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 1
minor 5.1
year 2002
month 06
day 17
language R
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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