Creating a GTK application

using Gtk;
using System;
 
class Hello {
 
        static void Main()
        {
                Application.Init ();
 
                Window window = new Window ("Hello MTE");
                window.Show();
 
                Application.Run ();
 
        }
}

Installation

sudo apt-get install gtk-sharp2

Compiling the example code

mcs hellogtk.cs -pkg:gtk-sharp-2.0

The pkg flag tells Mono that this program needs to use the GTK toolkit.

Running the application

The compiler should have successfully created a hellogtk.exe which you can execute within am X Windows session.

Here's a screenshot of the GTK application running on the Raspberry Pi.

Screenshot of the GTK application

Resources