Thank you Andrea for that very helpful tip. I have a followup question:
How do I attach events in my ruby code to access the events I create in
Here’s my question exactly:
Using glade, I created a file called “button.glade”. It is just a basic
window with a button in the middle of it. I set visible to true so it
would be visible. Then I selected the button object, clicked on the
“Signals” tab, and set the "clicked event to:
In a similar fashion I set the on_window_destroy event to
I saved the file as button.glade with the property set to use libglade.
Then I ran this command:
ruby-glade-create-interface button.glade > button.rb
It created this skeleton program:
This file is gererated by ruby-glade-create-template 1.1.4.
def initialize(path_or_data, root = nil, domain = nil, localedir =
nil, flag = GladeXML::FILE)
bindtextdomain(domain, localedir, nil, “UTF-8”)
@glade = GladeXML.new(path_or_data, root, domain, localedir, flag)
puts “on_button1_clicked() is not implemented yet.”
puts “on_window1_destroy() is not implemented yet.”
if FILE == $0
Set values as your own application.
PROG_PATH = “button.glade”
PROG_NAME = “YOUR_APPLICATION_NAME”
ButtonGlade.new(PROG_PATH, nil, PROG_NAME)
As you can see the methods “on_button1_clicked” and “on_window_destroy”
are easy to understand.
How do I make this exact same skeliton program for a GTKBuilder/ruby
program? I can get the window to pop-up using your advise from your
last post, but I can’t get the window to call Gtk.main_quit().
I’m attaching the file button.glade saved in gtkbuilder format. Can you
make a working file button.rb that has methods to destroy properly, and
spit out a message when you click the button?
Thanks in advance,