In a previous example we created a simple console program, in this example we will create a basic GUI program. To do this we need to install GTK.
Lets begin by installing GTK for mono
[codesyntax lang=”bash”]
sudo apt-get install gtk-sharp2
[/codesyntax]
Create a folder and a file called gtkexample as follows
[codesyntax lang=”bash”]
mkdir gtkexample
cd gtkexample
geany gtkexample.cs
[/codesyntax]
Now enter the following code
[codesyntax lang=”csharp”]
using Gtk;
using System;
class gtkHello {
static void Main()
{
Application.Init ();
Window gtkWin = new Window (“GTK Example”);
gtkWin.Show();
Application.Run();
}
}
[/codesyntax]
Now open the file manager, navigate to the gtkexample folder. This should look like this
Now double click on the gtkexample.exe. You should see something like the following