ruby-****@sourc*****
ruby-****@sourc*****
2004年 3月 30日 (火) 02:20:51 JST
------------------------- REMOTE_ADDR = 218.231.161.247 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/en/?tut-gtk-helloworld ------------------------- = Ruby/GTK2 Hello World - + {{link "tut-gtk-intro", "tut-gtk-intro", "tut-gtk", "tut-gtk-signals"}} {{image_right("helloworld.png")}} Here is a typical "Hello World" style program for Ruby/GTK2. This program is also available in the file "gtk/sample/misc/helloworld.rb" in 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