Hello, World! Simple Widgets Binding Events More Widgets Scrollbars Menus Canvas Make things look Beautiful More Information

Need to check the license of this document.
In any case, reproduction in verbatim is allowed.
We are moving to this wiki

Ruby/Tk Tutorial

So you found Ruby and liked it. Now you need a GUI toolkit. Be warned: gtk, Qt and fox have Ruby bindings as well. May be those suit your needs better.

This tutorial is aimed at people that want to use Tk as toolkit with Ruby. It does not really matter whether you are very proficient in Ruby or with toolkits. Examples may overwhelm the novice sometimes, but each line is explained. Step over it and come back in a later stage. The small differences in those lines provide a wealth of information for the more experienced programmer.

Note: This is a work in progress. Mail comments to Kero. Or edit directly on The wiki version (which will, at some point, make this version obsolete).

A few reasons to use Tk:

A few reasons not to use Tk

Installation Problems

If you installed Ruby yourself, possibly the Tk bindings do not work. First, make sure you have tcl/tk installed. Then look here.

The Course

Hello, World! How to start Tk from Ruby and the first little program,
Combining Simple Widgets, building a small GUI,
Binding Events, reacting on user input,
Combining More Widgets, building a behaving GUI,
Scrollbars, clean
Menus, in its many appearances
Canvas, the powerful draw-anything-on
Make things look Beautiful
More information Places where you want to look, too; before, during and after this course.
Kero