Giter Site home page Giter Site logo

gwidgets2's Introduction

The gWidgets2 package

The gWidgets2 package is a rewrite of the gWidgets package that allows R users to easily create graphical user interfaces (GUIs) from within R in a toolkit-independent manner. The package itself sets up an API for describing these interfaces. An accompanying package integrates this into the underlying toolkit library.

Currently there are the following packages:

  • gWidgets2RGtk2 for interfacing with the GTK set of widgets through the RGtk2 package.

  • gWidgets2tcltk for interfacing with the TCL/TK widgets through the tcltk package.

  • gWidgets2Qt for interfacing with the Qt set of widget through the qtbase

Additionally, for web programming the packages gWidgetsWWW2 and gWidgetsWWW2.rapache implement basically the same API using the ExtJs JavaScript libraries.

To use the package you need to have intalled: the underlying graphical toolkit libraries, one of the basic R interfaces (RGtk2, tcltk or Qt), then gWidgets2 and one or more of the gWidgets2XXX packages. The tcltk interface is usually the easiest, as the underlying graphical toolkit libraries are bundled with the standard windows binary of R, thought RGtk2 and Qt versions work with a much richer underlying set of controls.

The gWidgets2 API exposes only a small subset of what is available in the underlying toolkit, but does it in a fairly easy to learn way using many of R's standard methods, as possible.

A basic example of making a "hello world" app would be:

w <- gwindow("Hello...", visible=FALSE)       ## a parent container
g <- ggroup (cont = w)                        ## A box container
b <- gbutton("Click me for a message", cont=g, expand=TRUE)  ## some control

addHandlerClicked(b, function(...) {          ## adding a callback to an event
  gmessage("Hello world!", parent=w)          ## a dialog		    
})

visible(w) <- TRUE                            ## a method call

Though short, this example illustrates the range of basic tasks needed to construct a GUI. Some other examples are in the examples directory of the package and the package vignette.

Why a rewrite of the gWidgets package?

  • This should be much faster (early benchmarking is about 10-100% as fast). The gWidgets package had a cumbersome dispatch mechanism based on S4 methods. This rewrite uses a lighter-weight S3 dispatch and reference classes.

  • Should be easier to maintain. The documentation is done with roxygen2. The old version was by hand. It required some tedious stuff, best left unsaid.

  • rethinking some of the argument names, functions etc.. I don't think we need gcommandline, gformlayout, ggenericwidget, etc. These are best left to a separate package, if at all. Most of the arguments were made to be consistent. There weren't major changes, but enough to warrant adding a "2" to the package name.

  • The code in the toolkit implementations needed cleaning up. Lots of it. This rewrite gave reason to do so.

  • putting more structure on the toolkit. Before the class structure was left alone, leaving open the possibility that it could be made better (by someone else). Well, it wasn't. By enforcing a class structure with specific method names in the toolkit packages the code becomes more consistent. It should also make it easier for users to derive subclasses

  • adding in some other features. For example, gprogressbar, gtimer, gstackwidget, ...

gwidgets2's People

Contributors

jverzani avatar landroni avatar slomanl1 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.