Dieter Kaiser edited this page May 22, 2014 · 23 revisions


Ralph Schleicher has written a Atmosphere Calculator application which is a graphical user interface to calculate ambient conditions and air speeds. The graphical user interface is build with Glade and the CL-CFFI-GTK package provides the GKT+ bindings.

Atmosphere Calculator


I have added a chapter about Cairo and GTK+ to the GTK+ Tutorial for Lisp. This tutorial is taken from the offical Cairo website at which has been derived from Michael Urman's Cairo tutorial for python programmers.

The last section Writing a Widget Using Cairo and GTK+ shows a custom widget named egg-clock-face which draws a clock using Cairo. This Cairo Clock example is inspired by the C code from Davyd Madeley. egg-clock-face is defined as a subclass of the gtk-drawing-area class. Only the property time is added to hold the actual time of the clock. The initialize-instance method installs a timeout source with the function g-timeout-add, which updates every second the time property of egg-clock-face and requests the redrawing of the widget. The "draw" signal handler draws the clock into the gtk-drawing-area of the egg-clock-face widget.

Demo Cairo Clock


The gtk-numerable-icon class is a subclass of g-emblemed-icon that can show a number or short string as an emblem. The number can be overlayed on top of anotheremblem, if desired. It supports theming by taking font and color information from a provided gtk-style-context; see the function gtk-numerable-icon-set-style-context.

The implementation of the gtk-numerable-icon class and a small demo within the gtk-demo application are available. This is the output of the demo:

Demo Numerable Icons

This is the part of the code which creates the grid of numerable icons:

(dotimes (i 5)
  (dotimes (j 5)
    (gtk-grid-attach grid
                       (make-instance 'gtk-numerable-icon
                                      :gicon (g-themed-icon-new "gtk-ok")
                                      :count (+ (* j 5)(1+ i)))
                     i j 1 1)))


I have started to rework the chapter Menus and Toolbars about menus of the GTK+ Tutorial for Lisp. The chapter introduces the classes gtk-menu-bar, gtk-menu and gtk-menu-item. This is the example for making menus by hand:

Creating Menus by Hand


PassStorage is a small Lisp application which uses the cl-cffi-gtk library as a GUI. The code is a fork from the repository at andy128k / PassStorage which has been developped by Andrey Kutejko for GTK+ 2 with the cl-gtk2 library.

The application is implemented very similar to the Application window example below.



The cl-cffi-gtk library comes with a demo similar to the GTK+ demo for the C library. At this time the GTK+ Demo for Lisp includes 51 code examples. You find the GTK+ Demo for Lisp in the directory /demo/gtk-demo. Load the demo with the command (load "gtk-demo.lisp") from the Lisp prompt, execute the command (in-package :gtk-demo) and start the demo with the call (main).

The last example added can be used as a template for a small Lisp application. The example demonstrates a typical application window with menubar, toolbar, statusbar. The example uses GtkUIManager and GtkActionGroup which are implemented in the Lisp binding as the classes gtk-ui-manager and gtk-action-group.

Demo Application Window

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.