[ruby-gnome2-doc-cvs] [Hiki] update - tut-gtk-helloworld

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2004年 4月 8日 (木) 03:14:59 JST


-------------------------
REMOTE_ADDR = 80.137.231.102
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/de/?tut-gtk-helloworld
-------------------------
  = Ruby/GTK2 Hallo Welt
  {{link "tut-gtk-intro", "tut-gtk-intro", "tut-gtk", "tut-gtk-signals"}}
  {{image_right("helloworld.png")}}
  
  Hier ist das typische "Hello World"-Programm f Ruby/GTK2.
  
  Dieses Programm ist ebenfalls unter "gtk/sample/misc/helloworld.rb" in dem ruby-gnome2-Paket vorhanden.
  
    #!/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





ruby-gnome2-cvs メーリングリストの案内
Back to archive index