问题
I've just finished making another R tool for a colleague and have done a simple gWidgets GUI to go with it. However I'm having trouble getting it to come up on package load:
The error when building the package comes straight away in the .onLoad function, as soon as gwindow is called, on my system, even the following tidbit of code causes the error when I build the package binary - let alone my full gui:
.onLoad <- function(...){
MainWindow <- gwindow("My GUI Window!", visible=TRUE)
}
call: function (classes, fdef, mtable)
error: unable to find an inherited method for function '.gwindow' for signature '"NULL"'
Error: loading failed
Execution halted
ERROR: loading failed
I checked out Rcmdr's source files - tcltk objects/widgets are called in it's code in the .onLoad() function so I figures placing the code for my gui in the onload function would be the way to go. I make sure to import gWidgets and gWidgetstcltk (I'm on Windows).
来源:https://stackoverflow.com/questions/15647991/onload-and-gwidgets-r-error-in-package-build