I am trying to understand how to use gWidgets. I am using it to create a GUI for my colleagues with no programming background (Thus Rcmdr won't work). Here's a sample code:
options(guiToolkit = "RGtk2")
library(gWidgets)
library (tcltk)
# A function I found on SO that pauses the script
mywait <- function() {
tt <- tktoplevel()
tkpack( tkbutton(tt, text='Continue', command=function()tkdestroy(tt)),
side='bottom')
tkbind(tt,'<Key>', function()tkdestroy(tt) )
tkwait.window(tt)
}
# The interface
win <- gwindow("5 min interval")
Parameter.1 <- gcheckboxgroup(c("Apple","Bananas","Others"),container=win)
Parameter <- svalue(Parameter.1)
mywait()
x=1
Currently, I am experiencing several problems.
Firstly, there isn't a way for the user to close the widget other than by pressing "OK", unlike gmessage
, ginput
and gconfirm
.
Secondly, Parameter
is not being updated when the user chooses an option in the widget.
Thirdly, although I have a function to pause the script, it would be better if I can find a way to integrate that pausing in the same container as win
.
Can anyone help me please?