Hello, how do I centralize the texts inside a RTclTk listbox?

 

The code I am using is:

 

require(tcltk)

tt<-tktoplevel()

tl<-tklistbox(tt,height=4,selectmode="single",background="white")

tkgrid(tklabel(tt,text="What's your favorite fruit?"))

tkgrid(tl)

fruits <- c("Apple","Orange","Banana","Pear")

for (i in (1:4)){

  tkinsert(tl,"end",fruits[i])

}

tkselection.set(tl,2)  # Default fruit is Banana.  Indexing starts at zero.

OnOK <- function(){

  fruitChoice <- fruits[as.numeric(tkcurselection(tl))+1]

  tkdestroy(tt)

  msg <- paste("Good choice! ",fruitChoice,"s are delicious!",sep="")

  tkmessageBox(message=msg)

}

OK.but <-tkbutton(tt,text="   OK   ",command=OnOK)

tkgrid(OK.but)

tkfocus(tt)

 

Thanks!


	[[alternative HTML version deleted]]

