ruby-****@sourc*****
ruby-****@sourc*****
2003年 8月 16日 (土) 04:10:37 JST
------------------------- REMOTE_ADDR = 217.117.54.155 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/?Ruby%2FGTK2+Hello+World ------------------------- = Ruby/GTK2 Hello World Here is a typical "Hello World" style program for Ruby/GTK2. This program is also available in the file "gtk/sample/misc/helloworld.rb" from the ruby-gnome2 package. #!/usr/bin/env ruby =begin helloworld.rb - Ruby/GTK first sample script. Copyright (c) 2002,2003 Ruby-GNOME2 Project Team This program is licenced under the same licence as Ruby-GNOME2. $Id: helloworld.rb,v 1.4 2003/02/01 16:46:22 mutoh Exp $ =end require 'gtk2' Gtk.init button = Gtk::Button.new("Hello World") button.signal_connect("clicked") { puts "Hello World" } window = Gtk::Window.new window.signal_connect("delete_event") { puts "delete event occurred" #true false } window.signal_connect("destroy") { puts "destroy event occurred" Gtk.main_quit } window.border_width = 10 window.add(button) window.show_all Gtk.main