Monday, August 29, 2011

GTK... GIMP Toolkit (developing graphical user interface)

GTK is library for creating graphical user interface using c, c++ and python. We can use any programming language to create graphical interface. Actually it is developed to write program for GNU Image Manipulation Program(GIMP).

You can easily install it using synaptic package manager:
package : libgtkada2.14.2-dev

Here is a simple program that create a window of 200 * 200 pixel

base.c

#include <gtk/gtk.h>

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    
    gtk_init (&argc, &argv);
    
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 
gtk_widget_show  (window);
    
    gtk_main ();
    
    return 0;
}
 
compiling this code: 
gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0`
 
note: keep in mind that ` is different than ' otherwise it will create problem.

running this code:
./base
 
For more help 

No comments:

Post a Comment