[R] tcltk scrollbar

Jonne Zutt j.zutt at tudelft.nl
Mon Oct 8 10:02:51 CEST 2007


Maybe I do...
I think the OP means the first scrollbar isn't tight to the first
listbox. This is due to the length of the "Basic Manipulation" label.

For example, try to pack this label as follows:
  tkgrid(lbl.MainT,columnspan=2,sticky="nw")

That helps?
Jonne.

On Mon, 2007-10-08 at 08:37 +0200, Peter Dalgaard wrote:
> kapo coulibaly wrote:
> > The following code should give me (at least that's what I think) two list
> > boxes with their individual scrollbars. But instead both scrollbars stick to
> > the same listbox even though they work as they should (scroll individual
> > listboxes). When I remove all the widgets on top everything works perfectly.
> > Any help would be highly apprecciated.
> > ps: all subsequent listboxes and scrollbars work perfectly, the first one
> > (column 1 of main window) is the only one constantly off.
> >
> >   
> Er,......
> 
> I just don't see it. What exactly goes wrong for you?
> 
> > library(tcltk)
> > tt<-tktoplevel()
> > mainFont<-tkfont.create(family="times",size=16)
> > lbl.MainT<-tklabel(tt,text="Basic Manipulation",font=mainFont)
> > tkgrid(lbl.MainT,sticky="nw")
> > but.Browse<-tkbutton(tt,text=" Browse ",command=browse)
> > but.Apply<-tkbutton(tt,text=" Apply ")
> > scr1 <- tkscrollbar(tt,
> > repeatinterval=5,command=function(...)tkyview(lsbDim1,...))
> > scr2 <- tkscrollbar(tt,
> > repeatinterval=5,command=function(...)tkyview(lsbDim2,...))
> > lsbDim1<-tklistbox(tt,height=10,selectmode="multiple",yscrollcommand=function(...)tkset(scr1,...),background="white",exportselection=FALSE)
> > lsbDim2<-tklistbox(tt,height=10,selectmode="multiple",yscrollcommand=function(...)tkset(scr2,...),background="white",exportselection=FALSE)
> > for (i in 1:70) {
> >     tkinsert(lsbDim1,"end",i)
> >     }
> > for (i in 1:70) {
> >     tkinsert(lsbDim2,"end",i)
> >     }
> >
> > tkgrid(lsbDim1,scr1,lsbDim2,scr2)
> > tkgrid.configure(scr1,rowspan=10,sticky="nsw")
> > tkgrid.configure(scr2,rowspan=10,sticky="nsw")
> >   
>



More information about the R-help mailing list