gWidgets + tcltk - 创建一个简单的窗口会返回错误

时间:2013-10-07 09:07:52

标签: r gwidgets

我正在尝试制作一个小型GUI,以便其他人更轻松地运行脚本。 我在Windows机器上使用带有tcltk的gWidgets。

我创建了一个这样的简单窗口:

require(gWidgets)
require(gWidgetstcltk)

options(guiToolkit="tcltk")
win <- gwindow(title="This is a window!")
grp <- ggroup(container=win)
lbl <- glabel("Here you can write stuff:", container=grp)
txt <- gedit(text="Stuff", container=grp)

当我在新会话上运行时,我收到错误消息:

Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : 
  ‘no_items’ is not a valid field or method name for reference class “Entry”

如果我在错误后重新运行,我会得到这个:

<simpleError in envRefInferField(x, what, getClass(class(x)), selfEnv): ‘no_items’ is
not a valid field or method name for reference class “Entry”>

任何人都可以解释发生了什么事情?

修改 问题似乎只出现在RStudio而不是RGui.exe上。 我不是那么专业的程序员,但我想它与RStudio管理环境的方式有某种关系。

我想现在的问题更多:我如何在RStudio中正常工作?

回溯:

> traceback()
11: stop(gettextf("%s is not a valid field or method name for reference class %s", 
        sQuote(field), dQuote(thisClass@className)), domain = NA)
10: envRefInferField(x, what, getClass(class(x)), selfEnv)
9: r5_widget$no_items
8: r5_widget$no_items
7: .length(x@widget, x@toolkit)
6: .length(x@widget, x@toolkit)
5: FUN(X[[3L]], ...)
4: FUN(X[[3L]], ...)
3: lapply(X = X, FUN = FUN, ...)
2: sapply(globalValues, length, USE.NAMES = FALSE) at SessionWorkspace.R#166
1: (function () 
   {
       globals = ls(envir = globalenv())
       globalValues = lapply(globals, function(name) {
           get(name, envir = globalenv(), inherits = FALSE)
       })
       types = sapply(globalValues, .rs.getSingleClass, USE.NAMES = FALSE)
       lengths = sapply(globalValues, length, USE.NAMES = FALSE)
       values = sapply(globalValues, .rs.valueAsString, USE.NAMES = FALSE)
       extra = sapply(globalValues, .rs.valueDescription, USE.NAMES = FALSE)
       result = list(name = globals, type = types, len = lengths, 
           value = values, extra = extra)
       result
   })()

0 个答案:

没有答案