allora ho il seguente codice ruby che sfrutta per la gui Gtk+ 2
codice:
if __FILE__ == $0
# TODO Generated stub
require "gtk2"
$box
def delete_event(widget , event)
Gtk.main_quit
return false
end
def create_label(widget)
l = Gtk::Label.new("label")
$box.pack_start(l,true,true,0)
l.show
end
Gtk.init
window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
window.set_title("ciao")
window.signal_connect('delete_event') {|w,e| delete_event(w,e)}
window.border_width = (100)
button = Gtk::Button.new("Add")
button.signal_connect('clicked') {|w| create_label(w)}
$box = Gtk::HBox.new(false,0)
window.add($box)
$box.pack_start(button,true,true,0)
button.show
$box.show
window.show
Gtk.main
end
ma se lo avvio da eclipse mi da errore sul require "gtk2"
invece da terminale(sto su ubuntu) mi parte
perché?