Mar 21, 2008

Ruby/Gnome2

This is the definition of `What is Gtk' from The GTK+ Project:
  • GTK+ is a highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross platform compatibility and an easy to use API.

Sounds incredible nice!

Here is a simple HelloWord which is written in Ruby



require 'gtk2'

button = Gtk::Button.new("Hello World")
button.signal_connect("clicked") {
puts "Hello World"
}

window = Gtk::Window.newwindow.signal_connect("delete_event") {
false
}

window.signal_connect("destroy") {
Gtk.main_quit
}

window.add(button)window.show_all
Gtk.main



References:
- Ruby/GTK - Ruby-GNOME2 Project Website
- syntaxhighlighter

No comments:

Post a Comment