gwidgets

Loading and saving variables in R with gWidgets

心不动则不痛 提交于 2019-12-22 11:32:17
问题 For the past few months I've been building a simulation in R I hope to package. It consists of two usable functions, and many internal ones which one of the two usable functions call while looping, to perform the stages of simulation. A simple conceptual example is: # Abstract representation 1st Usable function, generates object containing settings for simulation. settings <- function(){ matrix(c(1:4),nrow=2,ncol=2) } # Abstract representation of one of many internal functions, does some

R Prompt User With Autocomplete

无人久伴 提交于 2019-12-21 19:44:43
问题 Is there a way in R to prompt a user (i.e. scanf) for information and also allow auto-completion of that prompt using an array of strings as possible completions? Basically, looking for something like GNU Readline for R (ideally with an example). 回答1: The autocomplete for function names, etc., seems to be a property of the development environment that is running R. So it works slightly differently in R GUI compared to eclipse compared to emacs compared to RStudio compared to whatever. From

R: Rgtk2: gwidgets: gWidgetsRGtk2

北城以北 提交于 2019-12-13 16:45:39
问题 I would like to combo gWidgets(john verzani) with Rgtk2. This could be used by anyone as a paradigm. The algorithm is as follows: STEP 1: Construct a gwindow (or a gframe) STEP 2: Construct a GTK scrollable text view STEP 3: Convert the last one into a gwidget STEP 4: Add it into the gwindow (or into the gframe) I wonder if this is a right thinking while the problem I face is with the GTK scrollable text view: I cannot make the scrollbars work. The code in R is as follows: ###################

gwidgets gtable refresh

非 Y 不嫁゛ 提交于 2019-12-13 12:04:21
问题 I encounter the following problem: library(gWidgets) options(guiToolkit = "RGtk2") aa <- c(1,2,3) bb <- c(4,5,6) cc <- cbind(aa,bb) cc <-as.data.frame(cc) t1 <- gtable(cc, container=TRUE) I want to refresh the content of t1 with: dd <- c(7,8,9) dd <- as.data.frame(dd) But when I run t1[] <- dd I receive: Can't replace with fewer columns Apostolos 回答1: To expand upon John's answer, here's an example. #Data cc <- data.frame(aa = 1:3, bb = 4:6) dd <- data.frame(X = 7:9) #Wigdets win <- gwindow()

Change mouse cursor of a widget in gWidgetsRGtk2

南笙酒味 提交于 2019-12-13 03:58:27
问题 I want to change the mouse cursor to a hand, for clicking an image. hlp<-gimage("help", dirname="stock", size="dialog") addHandlerClicked(hlp, handler=function(h,...) { browseURL("http://....")}) I have read other post related but setCursor doesn't work on Widgets. Thank you 回答1: Looking here (how can i change the shape mouse cursor in gWidgets RGtk2?) you can see what you need for RGtk2. Try this: library(RGtk2) w <- gwindow() g <- ggroup(cont=w) gbutton("button", cont=g) img <- gimage("

gWidgets - ginput() function error

£可爱£侵袭症+ 提交于 2019-12-13 03:49:39
问题 I'm having a problem with launching the ginput pop-up from gWidgets. This is the error: Loading required package: gWidgetstcltk Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘.ginput’ for signature ‘"guiWidgetsToolkittcltk"’ In addition: Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘gWidgetstcltk’ I use the popup to type a number that I then assign to a variable

How to bind ESC key to close a `gwindow()` in gWidgets?

﹥>﹥吖頭↗ 提交于 2019-12-13 02:56:16
问题 Consider: require(gWidgets2) w <- gwindow("notebook example", visible=T) nb <- gnotebook(container=w) gbutton("Page one", label="tab 1", container=nb) ## note label argument gbutton("Page two", label="tab 2", container=nb) How can I bind a given key (say, ESC ) to close the gwindow() in gWidgets, that is to execute dispose(w) ? In other words, how do you assign keybindings in gWidgets? 回答1: With RGtk2 (and possibly others) the addHandlerKeystroke method can be used to catch keystrokes. You

position of the labels in a widget

眉间皱痕 提交于 2019-12-12 02:21:45
问题 In the widget below, is it possible to change the position of the label of the "radio" groups. I would like something like that instead of having "Type" above the items: Type o Quantitative o Qualitative win <- gwindow("Empirical Phase Diagram") BigDataGroup <- ggroup(cont=win) DataGroup <- gframe("Data", container = BigDataGroup, horizontal=FALSE) grp.file <- ggroup(horizontal=FALSE, container = DataGroup) lbl.file <- glabel("File: ", container = grp.file) browse.file <- gfilebrowse

Extracing values of gedit in gbasicdialog

放肆的年华 提交于 2019-12-11 10:47:54
问题 I am trying to create a interface where the user can key in a number for the script to run. However, I am unable to retrieve the value keyed into gedit. Can anyone help me? Here's what I have done: require(gWidgets2RGtk2) #Load package w=gbasicdialog("key number") a<-gedit("1",cont=w,handler=function(h,...){number<-svalue(a)}) visible(w)=TRUE 回答1: Here I create , 2 gedit and update the value of one with the other value using a button: w <- gwindow("test") g <- ggroup(cont=w, horizontal=FALSE)

How to add a context menu to a `gframe`?

时光毁灭记忆、已成空白 提交于 2019-12-11 10:03:27
问题 How can I add a context menu to a gframe in gWidgets2 ? I tried the following construct, but it seems that I cannot attach a addPopupMenu to a gframe : require(gWidgets2) w <- gwindow("gformlayout", visible=T) f <- gframe("frame", horizontal=FALSE, container=w) l <- glabel("Lorem ipsum dolor sit amet, \nconsectetur adipiscing elit.", container=f) b <- gbutton("change name", container=f, handler=function(h,...) { names(f) <- "new name" }) lst <- list(gaction('world', handler=function(h,...)