CSC/ECE 517 Spring 2013/ch1a c ct: Difference between revisions
No edit summary |
|||
Line 41: | Line 41: | ||
== Overview of other GUI toolkits == | == Overview of other GUI toolkits == | ||
This article will not attempt to cover the same toolkits that were discussed in the previous articles. The following toolkits are not the most popular choices for Ruby GUI development. However, comparisons can then be made with more popular options by examining the necessary steps to get each one of them up and running | This article will not attempt to cover the same toolkits that were discussed in the previous articles. The following toolkits are not the most popular choices for Ruby GUI development. However, comparisons can then be made with more popular options by examining the necessary steps to get each one of them up and running | ||
=== Visual Ruby === | === Visual Ruby === | ||
Line 100: | Line 99: | ||
}.pack | }.pack | ||
Tk.mainloop | Tk.mainloop | ||
== Conclusion == | == Conclusion == |
Revision as of 02:37, 9 February 2013
Introduction
Ruby as a programming language has gained popularity in recent years (mainly due to the Rails web framework). There exists quite a few graphical user interface toolkits/frameworks for Ruby so that desktop GUI applications can be created. Most are simply bindings to existing GUI framework API's like Qt and GTK+, so they may seem awkward and unfitting to the Ruby language's style. Shoes, on the other hand, is written for Ruby specifically. Two previous articles have made detailed comparisons between different toolkits by looking at various factors such as ease of installation, documentation, look and feel, and difficulty of usage.[1][2] This article will give updates on GUI toolkits that has developed since the previous articles were written, as well as discuss other toolkits that were not present in the previous articles.
Current State of GUI Toolkits for Ruby
There is a number of Ruby GUI toolkits to choose from to create a desktop application. In one of the previous articles, an official 2008 Ruby GUI Survey was referenced to discuss the popularity of available GUI toolkits. For a quick recap, here is the result for the question "Which of the GUI toolkits do you currently use, and which do you think it's likely you'll use in the future?"
- Shoes
- Ruby-GNOME2/GTK
- wxRuby
- Ruby-Tk
- Ruby Cocoa/MacRuby
- QtRuby
- JRuby + Swing
- FxRuby
- JRuby + SWT
The Ruby Toolbox, a website that tracks the popularity of Ruby related tools by usage in open source projects, has a list of several toolkits under its "GUI Frameworks" category. The ranking in current popularity (Feb 2013) of GUI toolkits is as follows:
- Shoes
- FxRuby
- wxRuby
- QtBindings
- Ruby/GTK
- monkeybars
- FFI::Tk
Although this list is not as scientific as the official survey result, it does reflect current project usage quite well, and it shows the general acceptance of a particular toolkit. We can see by comparing the two lists that the most popular toolkits (Shoes, FxRuby, wxRuby, Ruby/GTK) are still relevant today. Shoes has proven to be a popular choice since its creation in 2007. Most of the other toolkits remain stable, judging by the dates of code commits of their respective repository. One main exception is wxRuby. wxRuby has not seen a release since September of 2009 even though wxWidgets, the C++ GUI library which wxRuby is based, is still in active development.
However, even though most of these projects are being maintained, there has not been much growth to the GUI community for Ruby. There's still a very low number of applications that are built using GUI toolkits for Ruby, and many of them are personal projects. A simply Google search for Ruby GUI toolkits will return results that mostly predates 2010.
Overview of other GUI toolkits
This article will not attempt to cover the same toolkits that were discussed in the previous articles. The following toolkits are not the most popular choices for Ruby GUI development. However, comparisons can then be made with more popular options by examining the necessary steps to get each one of them up and running
Visual Ruby
Visual Ruby is designed to simplify the process of adding a GTK+ windows to Ruby applications. It is also designed to completely integrate with the Glade user interface designer.
Installation
- Install Ruby 1.9.3
- Install Glade and GTK
- Install
>> gem install visualruby
Up and Running
To run Visual Ruby, simply run the following command
>> vr
After starting up VR, you will see a list of example projects that you can open and run.
Monkeybars
Monkeybars is a library that enables the use of Swing from JRuby. Monkeybars aims to allow you to continue using the GUI editing tools you are used to but makes it easy to write all your application logic in pure Ruby. It utilizes the Model, View, Controller (MVC) design pattern to separate view logic and user interface components from application logic.
It should be noted, however, that monkeybars should not be the first choice if you're looking to quickly create a GUI application from scratch. The overhead of getting one of these projects up and running will be relatively higher than some other libraries.
What monkeybars is good for is building large and complex GUI applications since it is based on the mature Java language and Swing libraries. If creating Swing applications with Ruby is what you're looking for, this will be a reasonable choice. [3]
Installation
- Install Java and JRuby
- Install Monkeybars
>> gem install rawr >> gem install monkeybars
Up and Running
To create a new project directory
>> monkeybars test_project
After creating a new monkeybars project, follow the detailed tutorials here to configure your project.
FFI-Tk
FFI-Tk is a pure Ruby FFI (foreign funciton interface) wrapper for the Tk GUI toolkit.
Installation
gem install ffi-tk
Up and Running
require 'ffi-tk' Tk.init Tk::Button.new('.', text: 'Press me'){ Tk.message_box(message: 'Hello, World!') }.pack Tk.mainloop
Conclusion
Although there are many toolkits available for building GUI applications with Ruby, there isn't much growth in this area relative to year 2010. One possible explanation is that the popularity of desktop application develop has yielded to web applications, which Ruby is most well known for due to it's Rails framework. By looking at the several toolkits examined above, we can also see why some of them remain to be less popular than others. Monkeybars, for example, has too much overhead just to get an application up and running. The more dependencies that are necessary, the heavier the toolkit feels.
It does seem, however, that the more popular options will continue to be stable projects. One example is Shoes. Shoes is currently at version 3, and a new version is coming soon. Shoes 4 will be the next version of Shoes[4]. Perhaps this is why the download page for Shoes is currently void of any content.