Search code examples
rgwidgets

Error in running the gWidgets2Qt demo


I've got this error while running the demo of the gWidgets2Qt package:

> demo(gWidgets2Qt)


    demo(gWidgets2Qt)
    ---- ~~~~~~~~~~~

Type  <Return>   to start : 

> ## run examples
> require(gWidgets2)

> options(guiToolkit="Qt")

> ## run examples
> source(system.file("examples", "run_examples.R", package="gWidgets2"))
Error in envRefSetField(x, what, refObjectClass(x), selfEnv, value) : 
  ‘.visible’ is not a field in class “GWindow”

please check also this question I've just asked for session info and a similar error I've got with the cranvas package which I think might be related to the above. Thanks a lot.

EDIT:

following the tips from @jverzani I tried a simple code which worked. Then I did some tests:

I get this when detaching the package

detach("package:gWidgets2Qt", unload=TRUE)
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-05-23 07:40:37’, when none found

Tried to re-load and run the demo but still didn't work I restarted ubuntu and tried again

library(gWidgets2Qt)
demo(gWidgets2Qt)

it run correctly, I only get error with the ex-graphics.R example which fails to run with this error at the first attempt:

Error in qsceneDevice(width, height, pointsize, family, the_scene) : 
  unused argument (the_scene)
In addition: Warning message:
In .removePreviousCoerce(class1, class2, where, prevIs) :
  methods currently exist for coercing from “AlternativeSingleEnum” to “character”; they will be replaced.
Error in qinvoke(<environment>, "initScene", ...) : 
  Implementation failed for method 'R::gWidgets2Qt::QtDevice::initScene'

and this one at the next attmpts:

Error in qsceneDevice(width, height, pointsize, family, the_scene) : 
  unused argument (the_scene)
Error in qinvoke(<environment>, "initScene", ...) : 
  Implementation failed for method 'R::gWidgets2Qt::QtDevice::initScene'

But all the other examples work. However, as soon as I load cranvas, with

> library(cranvas)

Attaching package: ‘cranvas’

The following object is masked from ‘package:gWidgets2’:

    visible, visible<-

demo(gWidgets2Qt) fails again and detaching cranvas

> detach("package:cranvas", unload=TRUE)
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-05-23 08:37:43’, when none found

demo(gWidgets2Qt) runs again. Has been this incompatibility already seen? Is this depending on invisible being masked from gWidgets2?


Solution

  • I'm not sure why this isn't working. I just installed the whole thing (qtbase, qtutils, gWidgets2, gWidget2Qt) on a linux setup and the demo starts. The ones involving graphs don't really work, but the basic demo does. To see if everything is working, try with something simple:

    w <- gwindow("something simple")
    b <- gbutton("click me", container=w)
    addHandlerChanged(b, handler=function(h,...) {
      gmessage("Hello world", parent=w)
    })
    

    If that doesn't work then there are installation issues