4 ms·
int main (string[] args) { var app = new Gtk.Application( "com.example.App", ApplicationFlags.FLAGS_NONE ); app.activate.conn
by TekMol 4y ago
int main (string[] args) {
var app = new Gtk.Application(
"com.example.App",
ApplicationFlags.FLAGS_NONE
);
app.activate.connect(() => {
var win = new Gtk.ApplicationWindow(app);
var btn = new Gtk.Button.with_label("Hello World");
btn.click.connect(win.close);
win.child = btn;
win.present();
})
return app.run(args);
}
Is this the equivalent of this html code?
<button onclick="window.close()">Hello World</button>
- deleted 4y ago[deleted]
- bonzini 4y agoYou probably would have to compare with an Electron wrapper of that line, but yes.
- aroman 4y agoNo. The Vala code is creating an entire window and application. Your HTML code is just creating a button inside a window and application that already exists. The equivalent portion is just these two lines: var btn = new Gtk.Button.with_label("Hello World"); btn.click.connect(win.close);