Skip to content

Instantly share code, notes, and snippets.

@nonchip
Last active August 2, 2016 15:22
Show Gist options
  • Save nonchip/fd2dce69aa0c2867a0c2adbf8fc6d246 to your computer and use it in GitHub Desktop.
Save nonchip/fd2dce69aa0c2867a0c2adbf8fc6d246 to your computer and use it in GitHub Desktop.
require "luarocks.loader"
lgi = require "lgi"
Gtk = lgi.require "Gtk"
Gtk.init!
window = with Gtk.Window
title: 'window'
default_width: 400
default_height: 300
on_destroy: Gtk.main_quit
has_resize_grip: if tonumber(Gtk._version) >= 3 then true
status_bar = with Gtk.Statusbar!
ctx = \get_context_id 'default'
\push ctx, 'Statusbar message.'
toolbar = with Gtk.Toolbar!
\insert (Gtk.ToolButton
stock_id: 'gtk-quit'
on_clicked: -> window\destroy!
), -1
about_button = with Gtk.ToolButton
stock_id: 'gtk-about'
.on_clicked= =>
with dlg = Gtk.AboutDialog
program_name: 'LGI Moon Demo'
title: 'About...'
name: 'LGI Hello (Moon)'
copyright: '(C) Copyright 2016 Kyra Zimmer'
authors: { 'Adrian Perez de Castro', 'Pavel Holejšovský', 'Kyra Zimmer' }
license_type: if tonumber(Gtk._version) >= 3 then Gtk.License.MIT_X11
transient_for: window
\run!
\hide!
\insert about_button, -1
\add with vbox = Gtk.VBox!
\pack_start toolbar, false, false, 0
\pack_start (Gtk.Label label: 'Contents' ), true, true, 0
\pack_end status_bar, false, false, 0
\show_all!
Gtk.main!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment