Chapter 12. Graphical Interfaces for Ruby
There is no denying that we are in the age of the graphical user interface (GUI). For as far into the future as we can see, some form of graphical interface is going to be the preferred way to interact with a computer.
I don't see the command line going away in the next decade or so; it definitely has its place in the world. But even the old-time hackers (who would rather use cp -R than a drag-and-drop interface) still enjoy a GUI when it is appropriate.
There are, however, significant difficulties with programming graphically. The first problem, of course, is designing a meaningful, usable "front end" for a program; in interface design, a picture is not always worth a thousand words. This book can't address these issues; our topic here is not ergonomics, aesthetics, or psychology.
The second obvious problem is that graphical programming is more complex. We have to worry about the sizes, shapes, locations, and behaviors of all the controls that can be displayed on the screen and manipulated with mouse and/or keyboard.
The third difficulty is that various computing subcultures have differing ideas of what a windowing system is and how it should be implemented. The disparity between these systems has to be experienced to be fully appreciated; many a programmer has attempted to produce a cross-platform tool only to find that the impedance mismatch between the GUIs was the hardest part to deal with.
This chapter can't help much with these problems. The most I can do is give a gentle introduction to a few popular GUI systems (as they relate to Ruby) and offer a few hints and observations.
The bulk of this chapter is devoted to Tk, GTK+, FOX, and Qt. Whatever your background, there is a good chance you are asking, "Why wasn't (insert name of favorite GUI) included here?"
There could be several reasons. One reason is limited space, since this book is not primarily about graphical interfaces. Another reason might be that your favorite system doesn't have a mature set of Ruby bindings yet (in which case you are encouraged to create them). Finally, not all GUI systems are created equal. This chapter tries to cover the ones that are most important and most mature and give the rest a passing mention.