Sweet: The GUI wrapper for Ruby/JRuby

Sweet is designed to provide the most readable and straight-forward DSL for the most common GUI toolkits while maintaining all of their flexibility. If you find any limits to this claim, please open a bug report or fix it on a fork if you feel adventurous.

The primary and most complete toolkit right now is SWT, which requires JRuby. Swing, wxRuby and Gnome2 exist with rudimentary support so far. Cocoa is in the making. Pull requests for new widgets and toolkits are always welcome.

Install

Sweet is available as a gem:

sudo gem install sweet

To install the necessary SWT libraries for your platform, run:

sudo sweet install

Example

Sweet.app 'My first Application', :layout => :fill do
  label 'Your name:'
  @name = edit_line

  button 'Push me' do
    puts "Hello, #{@name.text}!"
  end
end

You can then start your application via:

sweet my_app.rb

Or put the following lines into the head of your file:

require 'rubygems'
require 'sweet'

Also, take a look at the files in the example folder to get a head start.

Have fun!