Displaying 2 results from an estimated 2 matches for "fruitchoice".
2007 May 13
1
Dropdown boxes in tcltk and R
Hello,
I'm very much a newbie in R and more so in tcltk so apologies if this
question is stupid. Basically I am trying to use the combobox example
found here:
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/DropDown.html .
What I want to do is in that example get fruitChoice as a variable in R
in general. When I run that code, however, and the ask for fruitChoice
it says 'error not found'. I suspect it's because its embedded in a
function, but I can't work out how to unravel it. I've tried something
like this to no avail.
require(tcltk)
tclRequ...
2011 Oct 06
0
initial value in ComboBox tkwidget
...="What's your favorite fruit?"))
fruits <- c("Apple","Orange","Banana","Pear")
comboBox <-
tkwidget(tt,"ComboBox",editable=TRUE,values=fruits,textvariable=tclVar("Banana"))
tkgrid(comboBox)
OnOK <- function()
{
fruitChoice <- fruits[as.numeric(tclvalue(tcl(comboBox,"getvalue")))]
tkdestroy(tt)
msg <- paste("Good choice! ",fruitChoice,"s are delicious!",sep="")
tkmessageBox(title="Fruit Choice",message=msg)
}
OK.but <-tkbutton(tt,text=" OK...