0

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?

Wet Feet
  • 4,435
  • 10
  • 28
  • 41
  • I think you want `gbasicdialog`. – jverzani Nov 14 '13 at 18:21
  • How do I use it? I can't seem to return values from gbasicdialog. – Wet Feet Jan 14 '14 at 08:24
  • The `gbasicdialog` function allows you to call a handler when the dialog is closed. This is where you can store the state if needed (you might also save state when any child widgets change). Again, you'll have to manipulate a variable outside the scope of the handler (for this an environment can prove convenient). – jverzani Jan 14 '14 at 15:46

0 Answers0