So i have done an entire gwidget script which creates the GUI for running my scripts .
win <- gwindow("TITLE HERE",height=500,weight=500)
However it seems that whenever i maximize the window, or elongate the window size by dragging it, it breaks and the size doesn't fix anymore.
Any idea how to force the window to not be able to resize ? or a permanent way to fix the size.
Here is an image of my situation
http://imgur.com/cEtU773
I'm also using gwidgets and gwidgetscltk package
I think is not possible using gwidgets. You can set andle a "resize event or signal".
One alternative is to use RGtk2 (GTK+ 2.0):
library(RGtk2)
win <- gtkWindow("toplevel", show = FALSE)
gtkWidgetSetSizeRequest(win, 500, 500)
win$show()
gtkWindowSetResizable(win, FALSE)
Related
I'm using tibble's glimpse function that prints output adjusted to RStudio's console width. To get the most descriptive output, I want RStudio's console width to be large (something like 180).
How do I set the width using code and not manually? getOption("width") or options("width")[[1]] returns the width, but I cannot set it to a value as that throws an error.
Edit: I've even tried setting width using options("width" = 180). This step although edits width parameter but does not expand RStudio's console.
To change the width option, use
options(width = 180)
grDevices::dev.size() programmatically provides the size of the Viewer pane in RStudio.
Is there a similar command (or maybe even a hack) for programmatically obtaining the size of the Zoom window? A brief search of the rstudioapi commands doesn't seem to offer any leads.
It has been a long time since I've been stuck with a similar problem. Have you found the answer?
I went with this solution:
Start with window
}
x11() # open new window
boxplot(rnorm(100)) # wrtie some good box full of normal values.
#Plot it! You will see it on the new screen.
#Now, let's make this loop, and everything will appear.
while(TRUE){
cdev <- grDevices::dev.size("cm")
Sys.sleep(0.5)
cat("Width (cm):", cdev[1], "High (cm):", cdev[2], "\r")
cat("Press escape to break it.")
}
#Change the new windows number size, and those new numbers will flow.
I was wondering, if there is a way to start a shinyapp in RStudio in window mode with prespecified window size. I found a workaround via creating a new file with following code:
{library(shiny)
vwr = dialogViewer('modellvergleiche-irt-with-brms', width = 1600, height = 1200)
runGadget(shinyAppDir(appDir = '../modellvergleiche-irt-with-brms'), viewer = vwr)
} # Run app in presized window
But I find it pritty ugly (especially the appDir = '../modellvergleiche-irt-with-brms' part).
Is there a better way to implement this? Maybe even a build in setting in RStudio I did not find yet?
Sincerely Famondir
I'm using tibble's glimpse function that prints output adjusted to RStudio's console width. To get the most descriptive output, I want RStudio's console width to be large (something like 180).
How do I set the width using code and not manually? getOption("width") or options("width")[[1]] returns the width, but I cannot set it to a value as that throws an error.
Edit: I've even tried setting width using options("width" = 180). This step although edits width parameter but does not expand RStudio's console.
To change the width option, use
options(width = 180)
i have a gui with a area ggraphics and i would want create a subwindow with the graphic active in the area graphic, but dev.copy and svalue not work
options(guiToolkit = "RGtk2")
win<- gwindow ("window", width=1350,height=680,parent=c(1,1))
buttongraph<-gbutton("Click for enlarge graph",cont=win)
wingraphic<- ggraphics(cont=win)
hist(rnorm(100))
addHandlerChanged(buttongraph,handler=function(h,...){
subwin<- gwindow("subwin")
subwingraph<-ggraphics(cont=subwin)
svalue(wingraphic)
})
or
dev.copy(wingraphic)
The call svalue(wingraphic) <- "filename.png" tries to produce a graphic using some Gtk calls. It is fragile and if the comment in the file is still accurate, needs the device to be uncovered. Might work for you, but might not.
The ggraphics widget is just a frontend for cairoDevice which opens a new graphics device. If it was the current device, the call would be dev.copy(), not dev.copy(wingraphic) as dev.copy knows nothing about gWidgets objects. If you want to get the device for a given ggraphics object you can grab it with: getToolkitWidget(g)$getData(".devnum"), but you'll need to load RGtk2 first.
If you just want to make a given ggraphics instance the current device, you can do so with visible(subwingraph) <- TRUE.