It is a truth universally acknowledged that not everyone is comfortable working with a command line. Let’s face it, some of our coworkers will never get over their desire for a good 5-cent GUI.
We’re a Ruby (and Java) shop here at work, so after I learned Ruby and started writing some serious scripts, I looked for a GUI toolkit for Ruby. Sadly, I found the available alternatives lacking for one reason or another.
Shoes looked good at first glance, but when its creator dropped out of programming, the Shoes project grew stale.. More recently, according the The Ruby Way (3rd edition), work has resumed on Shoes, but in JRuby. Maybe it would be worth taking a new look at Shoes, since we use JRuby here.
I also looked at Tk, but when I last checked, there were holes in the Ruby implementation (the Python implementation was more complete).
Qt is another popular toolkit used in Ruby, but the licensing (for commercial entities) caused me to pass on it.
One of the things I looked for was support built-in — either built-in to the programming language (so it’s all part of the same install), or built-in to the operating system itself (Windows, in our case). For a while, I played with the idea of scripting in Python, so I could use its superior implementation of Tk — but the needs of the many (possible users of any scripts I might write) outweighed the needs of the few (programmers who could maintain Python scripts in a Ruby shop).
Lately, my inclination has been to use PowerShell to run Ruby scripts, and this extends to writing GUIs. PowerShell can build GUIs using either Windows Forms (the old and busted way) or Windows Presentation Foundation (WPF).
Here are a couple of links to building GUIs using WPF:
- I’ve got a PowerShell Secret: Adding a GUI to Scripts
- Creating PowerShell GUIs in Minutes using Visual Studio (Part 1)
Of course, when using PowerShell, it’s also a good idea to remember the Out-GridView cmdlet, which might be all the GUI some scripts need.