tk2swaplist | R Documentation |
The swaplist is perfect to select and arrange items in a given order from a fixed initial set of possible items.
tk2swaplist(items, selection, title = "Select items", ...)
items |
A vector with all items. |
selection |
A vector with preselected items (must be a subset of |
title |
The title of the dialog box, by default, "Select items". |
... |
Further parameters passed to swaplist, see its tcl man page: https://core.tcl-lang.org/tklib/doc/trunk/embedded/www/tklib/files/modules/swaplist/swaplist.html. |
A vector with the selected items in the chosen order.
tk2listbox()
, tk2tablelist()
## Not run:
library(tcltk2)
# tk2swaplist() makes its use super-easy
tk2swaplist(1:9, selection = c(1, 3, 5))
# Use of the swaplist on your own
tclRequire("swaplist")
tt <- tktoplevel()
opts <- tclVar()
sl <- tcl("swaplist::swaplist", tt, opts, 1:9, c(1, 3, 5))
cat("You choose:", tclvalue(opts), "\n")
rm(opts, sl, tt)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.