O'Reilly logo

Sams Teach Yourself Ruby in 21 Days by Mark Slagell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple Widget Layout

You learned yesterday about the idea of packing in Ruby/Tk. A widget needs to be packed before it can be seen, and the way a thing is packed determines its location within its parent.

The process is slightly different in Ruby/Gtk. Placement and visibility are achieved separately. Making things visible is very simple, because you can wait until everything in the window is set up, then invoke Gtk::Window#show_all. Placement is mostly a matter of understanding the roles of the Gtk::Bin, Gtk::Box, and Gtk::Table classes, so let's look at them next.

Bin Containers

A Bin is a special kind of container that has room for only one occupant. Descendant classes of Gtk::Bin include Gtk::Window and Gtk::Button. The Gtk::Bin#child method ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required