RGtk2 | An Interface between R and GTK | Theme library
kandi X-RAY | RGtk2 Summary
kandi X-RAY | RGtk2 Summary
An Interface between R and GTK+
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of RGtk2
RGtk2 Key Features
RGtk2 Examples and Code Snippets
Community Discussions
Trending Discussions on RGtk2
QUESTION
My R console is 3.5.1. I want to install the rattle package on my Mac Mojave 10.14.1. I realize that you have to install RGtk2 first but still got error messaging even when loaded "from source"
...ANSWER
Answered 2018-Dec-09 at 19:39This answer is a distillation of content I originally posted on my Johns Hopkins Data Science Specialization Community Mentor Github site in August 2017, in response to student questions about how to install Rattle on OS X in order to produce fancy rpart
plots with rattle::fancyRpartPlot()
.
The install requires the gtk toolkit, and on the Mac one way to accomplish this is, per R 3.0 and GTK+ / RGTK2 Error:
- Install macports — tool for installing mac packages
- run SUDO to install gtk2 on mac
sudo port install gtk2 ## (X11 -- not aqua)
- export new path
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
- From command line R, enter install rgtk2 with
install.packages("RGtk2",type="source")
to compile from source - Install the rattle package
install.packages("rattle",type="source")
NOTE: For the RGtk2
install to work correctly from RStudio, one must first confirm that the PATH
change listed above is applied to the shell that is used to start RStudio.
The most complete set of instructions is located at Sebastian Kopf's Gist page and verified by my own install on June 17, 2017. Once installed, loading the rattle library will generate the following output in the R console.
In order to use fancyRpartPlot()
, one will also need to install the rpart.plot
package.
QUESTION
I am creating a gbutton in gWidgets2 which will toggle between "go" and "stop" when it will be clicked.
I am following this example: toggling a group of icons in gWidgets
My Code:
...ANSWER
Answered 2019-Sep-02 at 09:30You can use blockHandlers() and unblockHandlers() functions to avoid this issue.
w= gwindow()
g1 <- ggroup(horizontal=FALSE, cont=w)
icon <- gbutton("go", container = g1)
#icon <- gimage(reject,cont=g1)
state <- FALSE # a global
addHandlerClicked(icon, function(h,...) {
#
if(!state) {
blockHandlers(icon)
svalue(icon) <- "stop"
unblockHandlers(icon)
} else {
blockHandlers(icon)
svalue(icon) <- "go"
unblockHandlers(icon)
}
state <<- !state
})
I tried this and it works for me.
QUESTION
I tried to install R packages 'rattle' but when I typed
...ANSWER
Answered 2017-Jun-29 at 13:01Below are the known compatible version which will definitely work. 1. Try to downgrade your R version to 3.3.2. 2. Download RGtk2 version with 2.20.33 and manually install it. 3. Install rattle version as 4.1
QUESTION
I need to install RGtk2 on mu Manjaro i3 laptop. When I install this package, I get the following error:
...ANSWER
Answered 2019-Aug-21 at 09:39I've stumbled upon the same issue on Fedora. The RGtk2
package is apparently using some Pango structures that shouldn't be using in the first place. Since v1.44, these structures are explicitly private, and thus the compilation error.
I've notified both the Pango and RGtk2 maintainers. For now, the only workaround is to downgrade Pango to v1.43.
QUESTION
The following R script is a simple GUI using gWidgets.
I was wondering why this code does not save the selected values by user in gcheckboxgroup.
...ANSWER
Answered 2019-Mar-07 at 17:14Thanks for jverzani's comment. However, that was not the solution.
Actually, by clicking the Run button in GUI, we have the selected_code is the R memory. But it can not be saved as it is inside the function/handler. So, we need to save (write) it in a file (.txt for example) using this code:
QUESTION
The basic problem seem to be that I can't retrieve the state of a widget from an internal function.
I am trying to make my package developed using gWidgets2RGtk2 compatible with gWidgets2tcltk. The package includes a graphical user interface implementing the possibility to save the state of the gui. The code works as intended using the RGtk2 but there are problems using tcltk. I have tried various variants of the if constructs used. I find it strange that I can read the state from within .loadState, but not from within .saveState. They are called from different places, so can the problem be related to environments? I have been stuck for a while so maybe I am blind to an obvious solution, or perhaps there is a much better way to accomplish the behaviour I am after. The below code exemplifies the problem.
I am using R version 3.5.1 on a Windows 10 system, gWidgets2tcltk_1.0-6, and gWidgets2_1.0-7.
...ANSWER
Answered 2019-Jan-29 at 08:24The cause of the problem was that addHandlerDestroy
is not suitable for saving widget state. It may work, as it did for RGtk2, but there is no guarantee that widgets will be reachable at this point. The solution is to use addHandlerUnrealize
instead, as pointed out by @jverzani in a comment:
You should try addHandlerUnrealize here (though I don't know if this works for RGtk2 and can't test). That will call destroy as long as your handler does not return FALSE but will execute before the destroy event so your widgets will still be available to read from. – jverzani Jan 24 at 16:38
Interestingly, the example code revealed different implementations of signalling the destruction of a window (see the original post for a workaround). Note that @jverzani consider pushing a fix, that will change this.
QUESTION
I'm trying to add "next" and "previous" buttons to my RGtk2 layout.
I've put the "next" and "prev" buttons into their own Hbox and added them to the end of the GUI.
Unfortunately the Hbox containing these buttons expands to take up a 1/3 of the overall area of the screen, as can be seen below:
I'd like the new hbox to take up as little space as possible, to allow maximum room for the second graph. How can I shrink the height of the Hbox?
I've tried inserting the hbox using packEnd, rather than packStart and it looks exactly the same.
Here's the code:
...ANSWER
Answered 2018-Nov-18 at 23:17The bottom box with the two buttons was set by default to expand. To set it to take minimal space use:
QUESTION
I made a GUI using RGtk2 named Main.R that works perfectly when run from RStudio but only works in CMD when I open R in it and then source the script. My goal is to make it fully portable and thus to write a .bat file able to run it.
Classical commands R CMD BATCH Main.R and Rscript Main.R don't work. In these cases, instead of waiting for me to interact, the window is closed immediately after its creation. After some research I only found out that the OP from run R script from .bat (batch file) (sadly unanswered) encountered a similar issue, but my question differs from his so I still believe my post is justified.
These commands don't even work for a very simplistic program I made with the same library, which indicates that the issue may be caused by GTk itself.
...ANSWER
Answered 2018-Jul-02 at 07:52Found the answer : I tried to use R interactively via batch mode, which obviously couldn't work as batch is non-interactive.
I nevertheless found a workaround thanks to this answer : https://stackoverflow.com/a/11567220/9765404, consisting in downloading R-Portable with all libraries used by my project installed locally and adding this function to the Rprofile.site file (in App/R-Portable/etc) :
QUESTION
I am trying to install Rgtk2 (dependency for rattle). I am using R thru Anaconda. I am getting the following error.
...ANSWER
Answered 2018-Apr-23 at 05:53anaconda has its own environment, which by default usually lacks X11 headers(e.g libx11-dev, or whatever you call it). Try "conda install -c conda-forge xorg-libx11" . It worked for me when a certain R-package threw an error "X11/Xlib.h : No such file or directory".
QUESTION
first post and I hope I'm doing everything correctly. I'm using RStudio: Version 1.1.423; R-Version: 3.4.2, OS: Windows 10
Short problem summary: I start a gwidgets based GUI and the text shows in the desired font size, but when I click the save button, it suddenly changes to a smaller font.
Context: I'm currently doing a systematic literature review and I use the Metagear package by mjlajeunesse (https://github.com/cran/metagear) to screen the abstracts and decide if I shuold include them. Here's a picture of the original GUI: Original Abstract Screener GUI
Short description of functionality: I just click on one of the buttons (Yes, No, Maybe) and the abstract screener moves on to the next abstract in the file. I then click save to save my progress.
Changes I made to the code: However, I added some additional fields so I had to change that behaviour, so that it doesn't immediately jump to the next entry as soon as I click one of the buttons. So I merged that part of the function with the save function. Now I get the following behaviour: When I first open the abstract screener the fontsize is as desired as seen in this picture: Adapted Abstract Screener before clicking Save & Next
As soon as I click Save & Next it shows me the next abstract (as desired), but suddenly the font changes to a much smaller one, making it rather unpleasant to read, because it's so small, as seen here Adapted Abstract Screener after clicking Save & Next
Here's the code that I use/adapted to override the original functions of the metagear package. I iteratively adapted the code so I only included the functions of the metagear package that I needed to make things work. Here's the code I'm using(I included the code I use to execute the different functions at the bottom, including some sample data frame, instead of my CSV file):
...ANSWER
Answered 2018-Mar-12 at 18:09Sorry, my guess is that the font.attribute you specify for text_TITLE
isn't being preserved after you call svalue(text_TITLE) <-
. The easy solution would be to call font(text_TITLE)<- ...
after setting the text. The proper solution would be to fix this method: https://github.com/jverzani/gWidgets2RGtk2/blob/master/R/gtext.R#L84 (this should use the method insert_text
https://github.com/jverzani/gWidgets2RGtk2/blob/master/R/gtext.R#L160 which does adjust for the font attribute.
With that in mind, you might try this 1-2 punch to set text:
svalue(text_TITLE) <- ""
text_TITLE$insert_text(new_text, "beginning")
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install RGtk2
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page