gtk3
GTK + 3 avec Vala
Recherche…
Bonjour le monde
Pourrait être encore plus basique, mais cela montre certaines des fonctionnalités de la langue Vala.
Le code
using Gtk;
int main (string[] args) {
Gtk.init (ref args);
var window = new Window ();
window.title = "First GTK+ Program";
window.border_width = 10;
window.window_position = WindowPosition.CENTER;
window.set_default_size (350, 70);
window.destroy.connect (Gtk.main_quit);
var button = new Button.with_label ("Click me!");
button.clicked.connect (() => {
button.label = "Thank you";
});
window.add (button);
window.show_all ();
Gtk.main ();
return 0;
}
Toutes les classes GTK + sont à l'intérieur de l'espace de noms Gtk
. Vous devez initialiser chaque programme GTK + avec Gtk.init ()
.
Compilation et exécution sous Linux
$ valac --pkg gtk+-3.0 gtk-hello.vala
$ ./gtk-hello
Cela a besoin du valac
compilateur, gcc
, les glib
et gtk3
packages de développement installés sur votre système.
Tiré du wiki GNOME .
Modified text is an extract of the original Stack Overflow Documentation
Sous licence CC BY-SA 3.0
Non affilié à Stack Overflow