Created
May 23, 2011 05:05
-
-
Save yurenju/986247 to your computer and use it in GitHub Desktop.
javascript gtk example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Gtk = imports.gi.Gtk; | |
function hello(widget) { | |
log("Hello World"); | |
} | |
function onDestroy(widget) { | |
log("destroy signal occurred"); | |
Gtk.main_quit(); | |
} | |
Gtk.init(0, null); | |
let win = new Gtk.Window({ type: Gtk.WindowType.TOPLEVEL }); | |
win.connect("destroy", onDestroy); | |
let button = new Gtk.Button({ label: "Hello World" }); | |
button.connect("clicked", hello); | |
button.connect("clicked", function() { | |
win.destroy(); | |
}); | |
win.add(button); | |
button.show(); | |
win.show(); | |
Gtk.main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment