Hi everyone, I am very new to Ruby. A few days earlier I was looking at
a ruby-gtk tutorial by Zetcode.com
(http://zetcode.com/gui/rubygtk/introduction/) which in one of the
examples provided contains the following lines that I have trouble to
understand
signal_connect "destroy" do
Gtk.main_quit
end
Why it is necessary to use a block at this particular circumstance? In
python, this can be declared directly as:
self.connect("destroy", gtk.main_quit)
The following is the original example.
class RubyApp < Gtk::Window
def initialize
super
set_title "Center"
signal_connect "destroy" do
Gtk.main_quit
end
set_default_size 300, 200
set_window_position Gtk::Window::Position::CENTER
show
end
end
This is the Python equivalent:
class PyApp(gtk.Window):
def init(self):
super(PyApp, self).init()
self.connect("destroy", gtk.main_quit)
self.set_size_request(300, 200)
self.set_position(gtk.WIN_POS_CENTER)
self.show()
Thank you very much
Sincerely
Lawrence