Singapore.rb meeting presentation slides and source code

I’m pretty glad to say that the Singapore.rb event went rather well today. The crowd was quite respectable, I think, maybe around 20+ people in all were there, old and new. Meeting up with people from just curious to looking around for programmers were quite heartening, from the days when it was just Choon Keat and I pinging each other on my blog and then over email.

Anyway for the participants of the even today, here are my slides in PDF.

FxRuby and Screensvr slides

And here are the source code:

This is a the sample code in Ruby/Tk.

require 'tk'

root =
button = {
    text "Click me"
    command proc { puts "Hello world!" }

This is the sample code in wxRuby.

require 'wx'
include Wx

class FxApp < App
 def on_init
  frame = nil, -1, "Wx2 Hello"
  panel = frame, 1
  button = panel,  2, "Click me"
  button.evt_left_down() { | event | puts "Hello world!"  }

This is the sample code in Ruby-GTK2.

require 'gtk2'
include Gtk

window =
window.signal_connect("destroy") { Gtk.main_quit }
button = "Click me"
button.signal_connect("clicked") {  puts "Hello world!" }

window.add button


This is the sample code in FxRuby.

require 'fox16'
include Fox

app =

main = app, "Fx Hello"
button = main, "Click me!"
button.connect(SEL_COMMAND) {  puts "Hello world!" }

This is the slightly more complex code in FxRuby.

require 'fox16'
require 'fox16/colors'
require 'fox16/kwargs'
include Fox

app =

main =, "Fx Hello",
                             :opts  => FXTopWindow::DECOR_ALL,
                             :width => 200,
                             :height => 100)

                         :width => 200,
                         :height => 55) {|pane| pane.backColor = FXColor::White }

                            :width => 200,
                            :height => 15) {|slider| slider.value = 0}

slider.connect(SEL_COMMAND) {  pane.text = "Argh! You let go!" }
slider.connect(SEL_CHANGED) {  pane.text = "Current slider value: #{slider.value}" }

Finally the complex looking graphics manipulation sample application you saw is actually glviewer.rb in the samples code in the FxRuby install.

You can download FxRuby from

Hope everyone had fun!


2 thoughts on “Singapore.rb meeting presentation slides and source code

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s