For fun, I decided to pick up Ruby and do some things in GTK. It’s pretty much entirely new to me, but I’ve gotten the hang of the basics.
At the moment, I can’t figure out how to properly nest a box within another box. For example, I have something along the lines of:
window = Gtk::Window.new
main_box = Gtk::HBox.new(false, 2)
left_box = Gtk::VBox.new(false, 2)
right_box = Gtk::VBox.new(false, 2)
main_box.pack_start(left_box, true, true, 0)
main_box.pack_start(right_box, true, true, 0)
window.add(main_box)
Off the top of my head, something like that should create a layout with two vertical boxes laid out side-by-side. I keep getting an error when trying to pack the boxes.
undefined method 'pack_start' for nil:NilClass (no method error)
I’m thinking that maybe I can’t pack an empty box that doesn’t yet include any widgets? Is there something I need to do to explicitly instantiate the boxes?
You may want to try visualruby to avoid having to hand-code your boxes. Its still in development stages now, but I’ll be uploading a new version very soon. Go to:
http://visualruby.net