Sunday, March 17, 2019

A rewrite of the Ruby example programs from the Tcl/Tk tutorial at TkDocs

Arguably, for the Ruby computer programming language, the default graphical user interface (GUI) toolkit is Tk (a part of Tcl/Tk). A high-level toolkit, it is cross-platform as well. Some ways of installing Ruby include Tk automatically.

Tk has been given a beautiful introduction in a tutorial by Mark Roseman at TkDocs. Begun in 2008 (its full history can be seen here), it covers multiple languages: Perl 5, Python 3, Ruby, and Tcl.

Roseman's tutorial provides eighteen (18) code examples. They are all written in each of the four languages listed above. Naturally, the code is written in a way which eschews each language's idiomatic features. At least, uncomfortably, I experienced this for Ruby!

In order to learn more fully how to use Tk, I borrowed the tutorial's Ruby example code and rewrote it, using the kind of programming style I might use for production. All eighteen of the resulting Ruby production-style example programs (each in its own file) together comprise my GitHub repository, tutorial-tkdocs.

Copyright (c) 2019 Mark D. Blackwell.

No comments:

Post a Comment

Thanks for commenting on my post!