Login
Newsletter
Werbung

Thema: Bassi: Ist Vala tot?

1 Kommentar(e) || Alle anzeigen ||  RSS
Kommentare von Lesern spiegeln nicht unbedingt die Meinung der Redaktion wider.
0
Von What?? am Do, 16. Februar 2017 um 21:59 #

vala (imer aktuellstes gtk+)
--------------------------
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;
}

--------------------------
go (mit wrappern)

package main

import (
"github.com/conformal/gotk3/gtk"
"log"
)

func main() {
// Initialize GTK without parsing any command line arguments.
gtk.Init(nil)

// Create a new toplevel window, set its title, and connect it to the
// "destroy" signal to exit the GTK main loop when it is destroyed.
win, err := gtk.WindowNew(gtk.WINDOW_TOPLEVEL)
if err != nil {
log.Fatal("Unable to create window:", err)
}
win.SetTitle("Simple Example")
win.Connect("destroy", func() {
gtk.MainQuit()
})

// Create a new label widget to show in the window.
l, err := gtk.LabelNew("Hello, gotk3!")
if err != nil {
log.Fatal("Unable to create label:", err)
}

// Add the label to the window.
win.Add(l)

// Set the default window size.
win.SetDefaultSize(800, 600)

// Recursively show all widgets contained in this window.
win.ShowAll()

// Begin executing the GTK main loop. This blocks until
// gtk.MainQuit() is run.
gtk.Main()
}

[
| Versenden | Drucken ]
Pro-Linux
Pro-Linux @Facebook
Neue Nachrichten
Werbung