-1

我在运行gWidgets2Qt包的演示时遇到了这个错误:

> 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”

请同时检查这个问题,我刚刚询问了会话信息,以及cranvas我认为可能与上述有关的包中出现的类似错误。非常感谢。

编辑:

按照@jverzani 的提示,我尝试了一个有效的简单代码。然后我做了一些测试:

我在拆包时得到这个

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

尝试重新加载并运行演示,但仍然没有工作我重新启动了 ubuntu 并再次尝试

library(gWidgets2Qt)
demo(gWidgets2Qt)

它运行正确,我只收到 ex-graphics.R 示例的错误,该示例在第一次尝试时无法运行并出现此错误:

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'

这个在下一个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'

但是所有其他示例都有效。但是,一旦我加载 cranvas,

> library(cranvas)

Attaching package: ‘cranvas’

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

    visible, visible<-

demo(gWidgets2Qt)再次失败并分离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)再次运行。这种不兼容已经看到了吗?这取决于invisible被掩盖gWidgets2吗?

4

1 回答 1

1

我不确定为什么这不起作用。我刚刚在 linux 设置上安装了整个东西(qtbase、qtutils、gWidgets2、gWidget2Qt),然后演示开始了。那些涉及图表的东西并没有真正起作用,但基本的演示可以。要查看一切是否正常,请尝试一些简单的方法:

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

如果这不起作用,则存在安装问题

于 2013-05-23T00:28:06.210 回答