More Widget Types

As mentioned earlier, this chapter does not attempt to document every feature of Gtk or Ruby/Gtk, but there are several other fundamental Gtk classes that you are likely to find useful, and we would be remiss not to mention them. They will be introduced in the following four sample scripts.

Sample 1: CheckButton and RadioButton

Listing 18.8 lets the user configure a burger for lunch.

Listing 18.8. The Burger Stand
 01: #!/usr/bin/env ruby 02: 03: require 'gtk'; include Gtk 04: 05: class BurgerSelector < Window 06: def initialize 07: super() 08: add(vb = 09: vb.add(hb = 10: 11: hb.add(meats = 12: meats.add(rb_beef =,'Beef')) 13: meats.add(rb_turkey =,'Turkey')) ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.