[R] help with tcltk

Thomas Vogels tov at ece.cmu.edu
Wed Feb 14 18:33:43 CET 2001


Frank Gerrit Zoellner <fzoellne at TechFak.Uni-Bielefeld.DE> writes:

> Hallo!
> 
> Can anyone explain to me how to add a vert. scrollbar to a listbox using tcltk please?

By add, to you mean link them so that the scrollbar, well, scrolls the
listbox?  The following works for me (patterned after demo(tkfaq)):

local({
        require(tcltk)
        tt <- tktoplevel()
        tkwm.title(tt,"Data sets in package 'base'")
        tlb <- tklistbox(tt,yscrollcommand=function(...)tkset(tscr,...),
                                width=40,height=10)
        tscr <- tkscrollbar(tt,orient="vert",
                                command=function(...)tkyview(tlb,...))
        tkpack(tscr,side="right",fill="y")
        tkpack(tlb,side="right",fill="both",expand=1)

        INDEX <- file.path (.Library, "base", "data", "00Index")
        for (jj in gsub ("\t.*$", "", readLines (INDEX, n=-1)))
                if (jj != "") tkinsert (tlb, "end", jj)
})

Enjoy,
  -tom

-- 
mailto:tov at ece.cmu.edu (Tom Vogels)   Tel: (412) 268-6638   FAX: -3204
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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