Next Previous Contents

2. Introduction

The SLgtk package binds the GIMP Toolkit, also known as Gtk, to the S-Lang scripting language. It provides an importable module which makes most of Gtk and its constituent libraries callable directly from S-Lang scripts. With SLgtk the S-Lang programmer now has access to a powerful, cross-platform widget set for creating sophisticated graphical user interfaces (GUIs). Bindings to a subset of the GtkExtra widget set are also provided, for 2D visualization.

A driving force behind the development of SLgtk has been the notion of the guilet (pronounced "gooey-let"), by which we mean to connote visual interfaces of a small-ish, scriptable nature, that may be easily embedded within -- and launched from -- other programs, even applications with interactive command lines and no ostensible graphical interface.

As such guilets fill an important software niche, the middle ground between novice users -- who often argue that visual interfaces make software easier to use -- and power users -- who frequently complain that GUIs are more cumbersome and inflexible than command lines. Experience suggests that the code size and development cycle of the typical guilet is considerably smaller than that of traditional, monolithic GUIs (by which we mean to connote applications coded from scratch to have only a visual interface, typically utilizing a compiled language in conjunction with lower-level toolkits such as Xt, Motif, or the Microsoft's Windows Foundation Classes). Moreover, given their scripting heritage, guilets can be more amenable to changing requirements or ad-hoc experimentation and customization by the end-user.

Other benefits of embedded guilets are the memory conservation and seamlessness of operation which can result from having visualization capabilities located more closely to the data upon which they will operate. That is, it can be vastly preferable to generate sophisticated graphics from within the same address space of the process holding the data to, say, model plasma emission, rather than having to invoke a distinct process (loading the entire dataset again) to generate, say, a 3D image or surface plot from such. It is increasingly common, within astronomy for instance, for scientists to interactively analyze datasets 500 megabytes and greater in size. As dataset sizes scale even higher even the most powerful desktop workstation will starve for memory if several copies of such behemoths must be simultaneously resident in RAM.

2.1 Code Generation

Most of the over 2000 functions present in the SLgtk module are created automatically by inspection of the header files of Gtk and its constituent libraries, using the bundled SLIRP code generator (documentation available online at the SLIRP website). Note that a list of functions omitted by the code generator is created during the SLgtk build process, and that the checkgtk script may also be used to determine whether or a given function has been wrapped.

2.2 Non-interactive Execution

Given their role as graphical toolkits Gtk and SLgtk will most frequently be used interactively, e.g. from an X windows session. Sometimes, however, one might like to utilize them within a windowless environment, such as a cron job or remotely-executed regression test. Towards that end SLgtk bundles the xvfb-run script, which is described in chapter Utilities.

Next Previous Contents