1

I have just started making GUI's in R and as a first step I'm working with gWidgets before venturing into some lower level frameworks...

I would like to add a spinning wheel animation to show that a process is running. While gWidgets doesn't seem to support this, RGtk2 does.

So my basic question is how to add an RGtk2 widget to a gWidgets GUI when the widget is not 'natively' supported by gWidgets. Also, how do you manipulate the widget once added...

Thanks in advance

Thomas

4

1 に答える 1

2

gWidgetsまたはgWidgets2(github上)でこれを行う方法は次のとおりです。

library(gWidgets) ## or gWidgets2
options(guiToolkit="RGtk2")
library(RGtk2)    ## needed

w <- gwindow()
g <- ggroup(cont=w)
g1 <- ggroup(cont=g) ## holds spinner

b1 <- gbutton("stop spinner", cont=g, handler=function(h,...) {
  spin$stop()
})
b2 <- gbutton("remove spinner", cont=g, handler=function(...) {
  delete(g, g1)
})


spin <- gtkSpinner()
spin$start()

## pack into g1 box container:
## in gWidgets2 can do this: add(g1, spin)
## for gWidgets it can be hacked:
g1@widget@widget$packStart(spin)

gWidgets2には、gprogressbar同様のことを行うウィジェットがありますが、これはありません。

于 2012-10-10T15:35:02.460 に答える