#!/usr/bin/ruby
#
## https://rosettacode.org/wiki/Simple_windowed_application
#
use('Gtk3 -init')
# Window.
var window = %s'Gtk3::Window'.new;
window.signal_connect('destroy' => { %s'Gtk3'.main_quit });
# VBox.
var vbox = %s'Gtk3::VBox'.new(0, 0);
window.add(vbox);
# Label.
var label = %s'Gtk3::Label'.new('There have been no clicks yet.');
vbox.add(label);
# Button.
var count = 0;
var button = %s'Gtk3::Button'.new(' Click Me ');
vbox.add(button);
button.signal_connect('clicked' => {
label.set_text(++count);
});
# Show.
window.show_all;
# Main loop.
%s'Gtk3'.main;