Forum: Ruby-Gnome 2 ruby and glade/gtk+

Posted by Rodrigo Durá (granrodrigo)
on 2010-05-01 01:28
Hi, well i'm going to explain my problem.

RUBY
====

I'm a windows user, but i want to program on ruby 1.9, there wasn't a
msi installer so i downloaded the binaries (Ruby 1.9.1-p129-i386 Binary)
and put it on "C:", then i modified the path variable to the ruby/bin
directory; then i tried a "hello world" with scite, pressed f5 and it
works! :D (just like php).

GLADE/GTK
=========

Then i donwloaded the msi installer for glade 3.6.7 and gtk+ both came
in one msi installer, no need to correct path variable i guess, then i
install it on "C:", i want this versions because i've heard that
libglade is deprecated, now gtkbuilder rules, well, glade runs ok.

PROBLEM
=======
i don't know what is missing, because i tried some code from internet
calling a simple window and returns this error:

in `require': no such file to load -- Gtk (LoadError)


this is the code:

require 'Gtk'

window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL)
button = Gtk::Button.new("Hello World")

window.set_title("Hello Ruby")
window.border_width(10)

# Connect the button to a callback.
button.signal_connect('clicked') { puts "Hello Ruby" }

# Connect the signals 'delete_event' and 'destroy'
window.signal_connect('delete_event') {
  puts "delete_event received"
  false
}
window.signal_connect('destroy') {
  puts "destroy event received"
  Gtk.main_quit
}

window.add button
window.show_all
Gtk.main

Please help, thank you
Posted by Carlo E. Prelz (Guest)
on 2010-05-01 08:28
(Received via mailing list)
Subject: [ruby-gnome2-devel-en] ruby and glade/gtk+
  Date: sab 01 mag 10 01:28:51 +0200

Quoting Rodrigo Durá (ruby-forum-incoming@andreas-s.net):

> require 'Gtk'
I am not a windows user, but in my linux code I have to write

require 'gtk2'

(note the lowercase g and the 2 at end)

I believe this should be the case for windows, too.

HTH

Carlo

--
  *         Se la Strada e la sua Virtu' non fossero state messe da 
parte,
* K * Carlo E. Prelz - fluido@fluido.as             che bisogno ci 
sarebbe
  *               di parlare tanto di amore e di rettitudine? 
(Chuang-Tzu)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.