I went a little crazy this week-end, and decided to look for a way to write GUI programs on Linux in ruby. I was pleasantly surprised by how easy it is.

Comments

This entry was posted on Monday, May 21st, 2007 at 6:41 pm and is filed under Linux, Ruby. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

13 Comments so far

  1. iongion on May 21, 2007 9:42 pm

    Wow :P, you call that easy ?

    Easy is when you drag your components, stick them into an layout system that doest kill the brain(like anchor based layouts).

    Easy is when you create custom components from existing ones and when the gui builder does also code-gen work for you.

    As easy as it seems to you (do not know where you come from, probably from java) it looks prehistoric these days.

    Look at IntelliJ GUI builder, also look@ any .net gui builder(mono or dotnetfx-doesnt matter what target) or some of Borland’s builders.

    Hell, look at eclipse based Adobe Flex IDE …

    Those things are easy and focus your programmer’s work on whats important, because this is what matters, functionality.

  2. rob on May 22, 2007 6:22 am

    This is easy compared to how it was a few years ago (perhaps even a year ago). And I don’t think any of the things you mentioned are free (let alone support ruby).

  3. iongion on May 22, 2007 10:22 am

    Some of them are free or have a free version limited in some functionality. Ex: :

    - http://msdn.microsoft.com/vstudio/express/
    - http://www.lazarus.freepascal.org/
    - http://www.icsharpcode.net/OpenSource/SD/
    - monodevelop

    these are the “Cream” of the free tools :) and indeed none of them for ruby which brings you to the conclusion of what is ruby good for on this part …

  4. Andrew on May 23, 2007 2:54 pm

    Terrific. One question, could you add the source code for this? Your video is too blurry to see properly :-). Thanks!

  5. rob on May 24, 2007 7:36 am

    Hi Andrew,

    Most of the source code for that is generated, but for the parts I typed:

    def on_window_destroy(widget)
    GTK.main_quit
    end

    and

    def on_runbutton_clicked(widget)
    @glade['textentry'].text = “Test”
    end

    those methods themselves should get added by the program ruby-glade-create-template when you feed it the .glade file.

    Also the ‘textentry’ bit is what we put in the Name field in Glade.

    I hope that helps

  6. [...] http://robrohan.com/2007/05/21/linux-gui-programming-with-ruby/ se puede encontrar un exelente manual de iniciación de programción con Ruby y [...]

  7. David Pennington on July 15, 2007 1:43 pm

    Hey, thanks for the video rundown on this. I have been trying out both Swing via JRuby and GTK-ruby… so far, GTK looks more mature in terms of building a real application. JRuby / Swing could be cool in the future, but right now JRuby is intolerably slow when it is interpreted and jrubyc (in v1.0) can’t compile anything other than simplistic code. I have no real background in GUI programming and your video tutorial is just the thing I was looking for.

    BTW, how did you do the screen capture with sound?

  8. rob on July 15, 2007 3:18 pm

    “BTW, how did you do the screen capture with sound?”

    http://robrohan.com/2007/05/19/howto-screencast-in-ubuntu-7/

    :-D

  9. Ben on July 17, 2007 5:47 pm

    Thanks for this Rob. Really excellent video. :-)

  10. Morning Brew #84 on October 24, 2007 6:03 am

    [...] Linux GUI Programming with Ruby – a short video demonstrating Glade based Linux GUI with Ruby. [...]

  11. Ben Dodd on June 21, 2008 2:24 am

    Hey Rob,

    Great vid. One thing to note for the latest version of Glade 3.4.5 (which looks a little different, and doesn’t use project files) is that you need to set the window Visible setting to be ‘Yes’. This is in the ‘Common’ tab on the right control panel. If you don’t do this when you execute your .rb file it looks like nothing is happening.

    Cheers
    Ben

  12. Ben Dodd on June 21, 2008 2:33 am

    I spotted something else :-P

    Under this function GTK is case sensitive:

    def on_window_destroy(widget)
    GTK.main_quit
    end

    In the latest version of ruby-gnome2 it must be Gtk not GTK.

  13. Alex Gorbatchev » Morning Brew #84 on July 6, 2008 9:10 am

    [...] Linux GUI Programming with Ruby – a short video demonstrating Glade based Linux GUI with Ruby. [...]

Name (required)
Email (required)
Website
Share your wisdom
  • Recent Comments