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

Back to archive index

ruby-gnome2-hiki-pt_BR****@sourc***** ruby-gnome2-hiki-pt_BR****@sourc*****
2004年 4月 9日 (金) 08:47:44 JST


-------------------------
REMOTE_ADDR = 200.216.146.35
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/pt_BR/?tut-gtk-helloworld
-------------------------
= OlMundo de Ruby/GTK2
{{link "tut-gtk-intro", "tut-gtk-intro", "tut-gtk", "tut-gtk-signals"}}
{{image_right("helloworld.png")}}

Eis um t$ByQ(Bico programa estilo "OlMundo" para Ruby/GTK2.

Este programa estdispon$ByW(Bel tamb$BqN(B no arquivo "gtk/sample/misc/helloworld.rb" no pacote ruby-gnome2.

  #!/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("OlMundo")
  button.signal_connect("clicked") {
    puts "OlMundo"
  }
  
  window = Gtk::Window.new
  window.signal_connect("delete_event") {
    puts "ocorreu um evento 'delete'"
    #true
    false
  }
  
  window.signal_connect("destroy") {
    puts "ocorreu um evento 'destroy'"
    Gtk.main_quit
  }
  
  window.border_width = 10
  window.add(button)
  window.show_all
  
  Gtk.main





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