3

On ubuntu 12.04 I installed gWidgets and am intending to use RGtk2 binding. Now, invoking of single components like

obj <- gbutton("hello man!", container = gwindow()) 

works, but whit other basic function

win <- gwindow("main app")
group <- ggroup(container = win)

I get the error I usually get when something`s not installed

Error in add(tag(obj, "contentPane"), value, expand = TRUE, fill = "both") : 
  error in evaluating the argument 'obj' in selecting a method for function 'add': Error     
  in function (classes, fdef, mtable)  : unable to find an inherited method for function   
 ".tag", for signature "<invalid>", "guiWidgetsToolkitRGtk2"

I tried reinstalling, both libgtk-dev, and R and gWidgets but nothing worked.

Any ideas?

Fedja Blagojevic
  • 813
  • 1
  • 10
  • 18

2 Answers2

2

I was getting the same error. I realized I did not install the dependencies so I installed the cairoDevice package and it worked beautifully. Hope this works.

Chris Rackauckas
  • 18,645
  • 3
  • 50
  • 81
1

Hmm, this seems to be an issue with the gwindow object being invalidated before it is passed on as a container to the group container. I've seen similar issues arise when the toolkit isn't specified. To see if that is cause of this issue, try copy-and-pasting this code:

library(gWidgets)
options(guiToolkit="RGtk2")

w <- gwindow()
g <- ggroup(cont=w)
l <- glabel("it is working", cont=g)
jverzani
  • 5,600
  • 2
  • 21
  • 17
  • Okay, I'll have to install ubuntu under a vm and see what the issue is. I'd be curious if the issue persists under gWidgets2: sapply(c("gWidgets2", "gWidgets2RGtk2"), devtools:::install_github, username="jverzani") – jverzani May 05 '12 at 20:20
  • Thank you John for taking time to look into this. – Fedja Blagojevic May 05 '12 at 20:43
  • Okay, I installed a fresh 12.04 with r-base-dev; libgtk2.0-dev and three packages: RGtk2, gWidgets and gWidgetsRGtk2. I could not replicate this issue. At this point, am not sure how to continue. Perhaps upgrading gWidgetsRGtk2 will work. As well, you might try gWidgets2. It is not so far from being released on CRAN. – jverzani May 06 '12 at 21:51
  • Uhh, this issue is really troublesome then. I tampered with almost everything but to no avail. I also tried github gWidgets2 version and this is the error I get: Error: attempt to call 'remove' on invalid reference 'content_area'. Now I will more easily reinstall ubuntu than trying this any further. Thanks. – Fedja Blagojevic May 07 '12 at 15:11
  • Ian, perhaps you should send me an email to my gmail address on this. For some reason it seems your objects are being garbage collected prematurely. This shouldn't happen as long as there is a reference to them. In the example "w" should do that and in gWidgets2, content_area is a property of the window. Can you think of any settings you have that might otherwise effect this? I'd also be curious if this happens in RGtk2: w <- gtkWindow(); b <- gtkButton("push"); w$add(b) – jverzani May 09 '12 at 12:08