Computer Science & C Programming


Gimp tool kit (Gtk)

GIMP - GNU Image Manipulation Program (see also GNOME)

  1. Gtk is a library to build Graphical User Interfaces and as its website.
    Gtk is used for instance by the default Gnome environment from Ubuntu Linux, or the Gimp and Geany applications.
  2. GUI are composed by basic components (button, text, input, etc.) and container (windows).
    A simple window can be built as follow:
#include <gtk/gtk.h>

int main(int argc, char **argv) {
	GtkWidget *window;
	gtk_init ( &argc , &argv );
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	/** CONT. HERE **/
	gtk_widget_show_all(window);
	gtk_main();
	return 0;
}

source

  1. Compilation:
gcc -c $(pkg-config --libs --cflags gtk+-3.0) window.c
gcc window.o $(pkg-config --libs --cflags gtk+-3.0) -o window.exe
./window.exe

Nb. the code requires installation of the library with here version 3.0
(i.e. sudo apt install libgtk-3-dev on debian/ubuntu, or here for Windows)


3 - 8