Par exemple, j’ai une application gtk simple:
public class Application : Gtk.Window { public Application () { this.title = "Zaebis"; this.window_position = Gtk.WindowPosition.CENTER; this.destroy.connect (Gtk.main_quit); this.set_default_size (170, 70); Gtk.Button button = new Gtk.Button.with_label ("Make everything zaebis"); this.add (button); button.clicked.connect (() => { button.label = "Everything is zaebis now"; }); } public static int main (ssortingng[] args) { Gtk.init (ref args); (new Application ()).show_all (); Gtk.main (); return 0; } }
Je le comstack valac --pkg gtk+-2.0 main.vala
mais quand je le lance, je vois aussi une console vide. Comment ne pas afficher / masquer cette console et afficher uniquement ma fenêtre?
Est-ce que vous l’exécutez sous Windows?
De https://wiki.gnome.org/Vala/ValaOnWindows :
Pour supprimer la fenêtre de console supplémentaire pour les applications GTK +, vous devez suivre les étapes suivantes:
- Télécharger l’API MinGW pour MS-Windows
- Extrayez w32api-x.xx-mingw32-dev.tar.gz dans le répertoire d’installation de Vala / MinGW
Passez -X -mwindows au compilateur Vala:
valac -X -mwindows --pkg gtk+-2.0 hellogtk.vala