Chapter 3. Building Applications - a Tutorial

Table of Contents

3.1. Create a Window
3.2. Add a Button with a Callback
3.3. Multiple Buttons
3.4. Packing Widgets in Boxes
3.5. Using Tables

Here is a tutorial that introduces some of the basic features of Gamma and GTK, such as creating widgets, attaching callbacks, ect.

3.1. Create a Window

#!/usr/cogent/bin/gamma

/* Example: Make a window.
 * This example loads the Gamma/GTK widget library,
 * creates and displays a blank window, and enters the
 * GTK main processing loop.
 */

/* Initialize Cogent interprocess communication, which is
 * necessary for using Gamma/GTK.
 */
init_ipc("a", "aq");


/* Create a new instance of a GtkWindow object. */
window = new(GtkWindow);


/* Show the window. */
window.show();


/* Enter the GTK main processing loop. */
gtk_main();