Getting RGtk2 working

Part of the necessary infrastructure for getting iNZight working is to have a working installation of RGtk2. I'll show you how to get three types of computers up to scratch.

First, let's get rid of the existing R installation, because we're going to put on the newest version. At the time of writing this is version 2.13.1, so replace that version number where it appears in later instructions.

Now, follow the appropriate set of instructions.

Windows 7 x64

Download and install R for Windows. The installer will choose for you and will install 32-bit and 64-bit versions.

You will now have two R icons on your desktop and two on your start menu. Remove the plain R icon, leaving the R x64 icon. (This is to avoid confusion later, as they do not share libraries.)

Set security permissions on C:\Program Files\R\R 2.13.1\library so that the current user can write to these directories.

Start R.

Run the following command:

options(repos = "http://cran.stat.auckland.ac.nz")
install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2", "devtools"))

There will be a flurry of downloading - roughly 20MB or so - and you'll be done.

Close R.

Download the GTK+ all-in-one bundle. I downloaded version 2.22 for Windows 64-bit.

Extract these files using 7-zip. Do not use Winzip! Do not use the native Windows extractor. I don't know why but both times I did the extraction was broken in a very subtle way and GTK+ failed to work. Much hair pulling out ensued. Save yourself the hassle and avoid Winzip. You will now have a directory named gtk+-bundle_2.22.1-20101229_win64. Rename this to GTK+.

Shift the GTK+ directory to C:\Program Files.

Edit the environment variable PATH to include C:\Program Files\GTK+\bin; at the start.

Start R.

Run this:

library(gWidgetsRGtk2)
gbutton("This works!", container = gwindow("Test"), handler = function(h, ...){ dispose(h$obj) })

You should see a button in a window that disappears after you click the button. If so then congratulations, you have done the correct thing.

RGtk2 working on Windows 7

Windows XP 32-bit

Download and install R for Windows. The installer will choose for you and will install the 32-bit versions. If you can handle the 64-bit version then you'll get that, but I have not tested for that.

Set security permissions on C:\Program Files\R\R 2.13.1\library so that the current user can write to these directories. (This may not be required.)

Start R.

Run the following command:

options(repos = "http://cran.stat.auckland.ac.nz")
install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2", "devtools"))

There will be a flurry of downloading - roughly 20MB or so - and you'll be done.

Close R.

Download the GTK+ all-in-one bundle. I downloaded version 2.22 for Windows 32-bit.

Extract these files using 7-zip. Do not use Winzip! Do not use the native Windows extractor. I don't know why but both times I did the extraction was broken in a very subtle way and GTK+ failed to work. Much hair pulling out ensued. Save yourself the hassle and avoid Winzip. You will now have a directory named gtk+-bundle_2.22.1-20101227_win32. Rename this to GTK+.

Shift the GTK+ directory to C:\Program Files.

Edit the environment variable PATH to include C:\Program Files\GTK+\bin; at the start.

Start R.

Run this:

library(gWidgetsRGtk2)
gbutton("This works!", container = gwindow("Test"), handler = function(h, ...){ dispose(h$obj) })

You should see a button in a window that disappears after you click the button. If so then congratulations, you have done the correct thing.

RGtk2 working on Windows XP

Mac OS X (10.6.8, Intel x64)

Download and install R for Mac OS X.

Start R.

Run the following command:

options(repos = "http://cran.stat.auckland.ac.nz")
install.packages(c("gWidgets", "RGtk2", "gWidgetsRGtk2", "devtools"))

There will be a flurry of downloading - roughly 20MB or so - and you'll be done.

Close R.

Download the GTK+ 2.18.5 framework.

Install the framework.

Start R.

Run this:

library(gWidgetsRGtk2)
gbutton("This works!", container = gwindow("Test"), handler = function(h, ...){ dispose(h$obj) })

You should see a button in a window that disappears after you click the button. If so then congratulations, you have done the correct thing.

RGtk2 working on Mac OS X

Stephen Cope 2011-08-05
http://www.stat.auckland.ac.nz/~kimihia/rgtk2