# Include required library
require 'gtk2'
# Initialize the mighty GTK+
Gtk.init
# Create the window, inform the user of this
@win = Gtk::Window.new
puts "creating window"
# Obviously we want this to be the title
@win.title = "Window Test"
# Create a virtual box
#hbox = Gtk::HBox.new(false, 0)
#@win.add(hbox)
#hbox.show
# Create a quit button
@quit = Gtk::Button.new("Please don't kill me :(")
@quit.signal_connect("clicked") {
puts "Destroying window"
# Destroy the window
Gtk.main_quit
}
@win.signal_connect("destroy") {
puts "destroy event occurred"
Gtk.main_quit
}
# Place the quit button in the virtual window
#hbox.pack_start(@quit, false, false, 0)
# Display everything
@win.add(@quit)
@win.show_all
# Add some padding to the border
@win.border_width=10
# Kinda pointless, but it makes it fairly big
@win.resize(500, 500)
# Finish up and execute GTK+
Gtk.main |