Showing posts with label gtk. Show all posts
Showing posts with label gtk. Show all posts

03 August 2010

After knew more about GTK, I decided not to go that way!

Al salamo Alykom,

Hi folks, how are you doing..

The last few days I were so interested in knowing about GTK and brothers. but after I knew About, I decided not going that way, at least not on a wide range!

So, Let me tell you what I found:
1- GTK is a GUI Tool Kit (it stands for GIMP Tool Kit) for doing GUI applications in C.
2- GDK stands for GTK Drawing kit
3- GLib is a low-level library used by GTK that replaces many of libc functions. (libc is the C standard library on Linux).
so in libGlib you may find functions for basic type definitions, memory management, string manipulations and alike )

I find that GTK (and its brothers) are intend to provide some object oriented C like features.

02 August 2010

Installing and running GTK applications on Linux (Ubuntu 10.04)

Al salamo Alykom,
Hi folks, How are you...

Today I'll talk about installing GTK and building simple GUI app using it.

to install GTK+2.0, from the command line write:
sudo aptitude install gnome-core-devel build-essential

That's all.

Now, Let's write a simple program using gtk+:
#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;
}

to compile, use the following command:
cc hello_gtk.c `pkg-config --cflags gtk+-2.0 --libs gtk+-2.0`

And here's the run result: