In the example of tk2widgets (see code below), functions tk2list.set(), tk2list.delete() and similar return error message:
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
[tcl] bad command "list": must be bbox, cget, configure, current, delete, get, icursor, identify, index, insert, instate, selection, state, set, validate, or xview.
Please, fix these functions.
The example:
library(tcltk2)
### A tk2combobox example
tt2 <- tktoplevel()
cb <- tk2combobox(tt2)
tkgrid(cb)
## Fill the combobox list
fruits <- c("Apple", "Orange", "Banana")
tk2list.set(cb, fruits)
tk2list.insert(cb, "end", "Scoubidou", "Pear")
tk2list.delete(cb, 3) # 0-based index!
tk2list.size(cb)
tk2list.get(cb) # All items
## Link current selection to a variable
Fruit <- tclVar("Pear")
tkconfigure(cb, textvariable = Fruit)
## Create a button to get the content of the combobox
but <- tk2button(tt2, text = "OK", width = 10,
command = function() {tkdestroy(tt2); cat(tclvalue(Fruit), "\n")})
tkgrid(but)
In the example of
tk2widgets
(see code below), functionstk2list.set()
,tk2list.delete()
and similar return error message:Please, fix these functions.
The example: