Next 5.3 GUIs in Tk, GTK+ Prev

GUIs in Tk, GTK+

require 'gtk2'
Gtk.init

window = Gtk::Window.new
button = Gtk::Button.new("Hello World")
button.signal_connect("clicked") { exit }
window.add(button)
window.show_all

Gtk.main
require 'tk'

root = TkRoot.new
TkButton.new(root) {
	text "Hello World"
	command { exit }
}.pack

Tk.mainloop

Next Ruby for Perl programmers Prev