tk_grid_pack_tools <- function(tour_bar, refresh_button, scale_radio_buttons,
parent = NULL, pack = TRUE, by = NULL,
row = 20, column = 20) {
# pack the bar
tcltk::tkgrid(tour_bar,
row = 0,
column = column,
rowspan = row,
columnspan = 1,
sticky="nesw")
# pack the refresh button
tcltk::tkgrid(refresh_button,
row = row,
column = 0,
rowspan = 1,
columnspan = 1,
sticky="nesw")
num_of_radiobuttons <- length(scale_radio_buttons)
buttonspan <- floor(column/num_of_radiobuttons)
# pack the radio_button
lapply(scale_radio_buttons,
function(scale_radio_button) {
tcltk::tkgrid(scale_radio_button,
row = row,
column = buttonspan * (which(scale_radio_buttons %in% scale_radio_button) - 1) + 1,
rowspan = 1,
columnspan = buttonspan,
sticky="w")
})
if(is.null(by)) {
for(i in (seq(row) - 1)) {
tcltk::tkgrid.rowconfigure(parent, i, weight=1)
}
for(i in (seq(column) - 1)) {
tcltk::tkgrid.columnconfigure(parent, i, weight=1)
}
}
if(pack)
tcltk::tkpack(parent, fill = "both", expand = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.