next up previous contents
Next: Signals and Call-backs Up: Using GTK Previous: Using GTK   Contents

Main loop

Creating of an application based on the GTK library takes three following steps:

The simplest possible program is shown in Fig B.1. This program will create a 200x200 pixel window and has no way of exiting except to be killed using the shell.

As you can see there is gtk_init() function call which does command line processing. Then there are two function calls: gtk_window_new() and gtk_widget_show(). They create and show a GTK widget called window. After that there is a function call: gtk_main() which enters GTK main processing loop.

Figure B.1: The simplest GTK program
\begin{figure}\begin{center}
\begin{verbatim}...

This is the usual way of creating GTK applications. GTK functions are named intuitively. For example for creating a window a function named gtk_window_new() is called. This is the rule of GTK. All GTK functions begin with gtk then there is a subject (window), and finally an action which is done on the specified subject (new). All parts are connected with underscores.


next up previous contents
Next: Signals and Call-backs Up: Using GTK Previous: Using GTK   Contents
Igor Wojnicki 2001-02-21