GUI programming for WinXP/Linux/OSX?

Discussion in 'Ruby' started by Roman Hausner, Sep 26, 2006.

  1. I am planning a project that has the following main requirements:

    - it must run on WinXP and Linux, idally also on OSX
    - it must have a GUI preferably with the GUI's native widget set
    - it must allow scripting access to system resources with a modern and
    comfortable scripting language

    The last point is what made me consider Ruby: I'd love to have Ruby
    as the embedded scripting language here.

    However, I cannot see how to solve the GUI issue, but maybe I have
    some things. Can anyone tell me if there is a common (portable) way to
    easily implement a GUI, no matter what the underlying framework and
    is? I am thinking some kind of GUI abstraction layer for using the same
    API to control the GUI, no matter what the underlying system and
    graphical framework is.

    Is this possible with Ruby? Any experiences to share?

    As I see it my only alternative is Java, especially as version 6 will
    seemingly come with nature widget support and support for scripting.

    If at all possible, I would prefer to do it all in Ruby though.
    Roman Hausner, Sep 26, 2006
    1. Advertisements

  2. Roman Hausner

    Thomas Adam Guest

    Tk, then.
    Native widget set? No such thing -- it's entirely dependant on the
    widget set you wish to use, and that certainly bears no relation to the
    GUI, as it's the widget set that ultimately *defines* it.
    Can you expand on that? What you're describing here is separate from
    the GUI, or should be.
    Again, Tk ships with Ruby, and works on Windows, so...

    -- Thomas Adam
    Thomas Adam, Sep 26, 2006
    1. Advertisements

  3. Thank you for the quick response. I was aware of Tk, but - honestly - I
    think Tk is ugly, anachronistic and even a lot worse than current Java
    Tk looks alien on all systems and it looks a lot more alien that
    Java Swing.

    This is going to be an educational program and I'd like to make the GUI
    as similar to what people are used to on their native OS as possible.
    This is especially a concern for things like the file picker, buttons

    Unfortunately, I am pretty new to portable GUI programming at all -- I
    hoping that there was some abstraction layer that would simply adapt the
    programmer's interface to whatever the native underlying OS requires.
    Roman Hausner, Sep 26, 2006
  4. Roman Hausner

    Mariano Kamp Guest

    Did you have a look at SWT? You would need JRuby to run it, but SWT
    gives you native widgets on OSX (Carbon), Windows and Linux (GTK and Motif).

    To start out you may want to have a look here:

    Mariano Kamp, Sep 26, 2006
  5. Roman Hausner

    Thomas Adam Guest

    It's all subjective, alas. I can semi-understand your concern
    regarding Tk, although I actually quite like it. I suppose I could
    suggest GTK to you as well as QT, since I know both those widget sets
    will run on Windows (with the proviso that they're installed of course
    -- certainly that doesn't ship natively with Windows), although I have
    no idea what that's like for the Mac, or even if ports are available
    for it. Again, there is also the wxWindows widget set (WxWindows is
    the old name for it -- I forget what it has been renamed to).
    Then your only concern really is going to be Windows and Mac, since
    Linux doesn't have the concept of a default look and feel to any of
    its GUIs, since different programs are written in different widget
    Nope. It's a case of try one and see.

    -- Thomas Adam
    Thomas Adam, Sep 26, 2006
  6. Roman Hausner

    Newbie Guest

    Perhaps wxRuby will help.
    Newbie, Sep 26, 2006
  7. I love GTK's layout system. Try using Glade to design an interface and
    you'll see what I mean. The only bad thing I've noticed in Ruby/GTK is
    that the tree / list view is highly confusing.
    Timothy Goddard, Sep 26, 2006
  8. sender: "Roman Hausner" date: "Tue, Sep 26, 2006 at 05:11:28PM +0900" <<<EOQ
    I have not used this, and have no ideea how well Tile plays with Ruby/Tk,
    but it certainly is not looking ugly at all:

    Hope it helps,
    Alexandru E. Ungur, Sep 26, 2006
  9. mmmkay ... :)

    Thank you all for your valuable answers! As far as I can see
    everyone has their own preference here.

    This is probably partly due to prior experience with a
    framework or the fact that a certain framework was chosen.

    As of now, the following choices seem to be available:

    = Tk: comes with Ruby, so should be easy to deploy.
    = Qt
    = GTK
    = JRuby plus some Java GUI, preferably SWT
    = It seems there is also FXRuby (
    (non-native widgetset).

    Does anyone know of some objective comparisons of these
    approaches? Especially with regard to learning curve,
    stability, integration with Ruby, interactive GUI design,
    and ease of deployment?
    As I said, I am new to GUI programming, so this all looks
    a bit intimidating at the moment.

    I probably will dig a bit into JRuby -- I guess this will
    make availbale a lot of Java library functions to a Ruby-like
    language -- and I guess, also take away all non-Ruby-only
    packages and extensions from the Ruby side.
    But having the existing set of Java libraries available
    together with Ruby as a programming and scripting language
    does sound very inviting indeed.
    Roman Hausner, Sep 26, 2006
  10. Roman Hausner

    Mc Osten Guest

    QT is quite nice on the MacOS X (although far from looking native).
    GTK does not exist on MacOS X (unless you run it in X11, but that is
    like saying the GUI is *NOT* native). A port is being made, but I don't
    know how well it works.
    wx is a lot worse than QT (on the MacOS X).
    Mc Osten, Sep 26, 2006
  11. Roman Hausner

    Mc Osten Guest


    Among cross platform environments QT is the one that better looks on
    MacOS X. If MacOS X is the concern.
    Mc Osten, Sep 26, 2006
  12. Roman Hausner

    Une bévue Guest

    Une bévue, Sep 26, 2006
  13. Roman Hausner

    Une bévue Guest

    what about FOX on Mac OS X ???
    Une bévue, Sep 26, 2006
  14. Roman Hausner

    Mc Osten Guest

    I never tried it. However, if you give me a short list of FOX
    applications, I'll be glad to try them and report my opinions.
    Mc Osten, Sep 26, 2006
  15. see also
    Reid Thompson, Sep 26, 2006
  16. I may be wrong, but I'm pretty sure FOX uses X11 under OS X. (But I
    don't like how FOX looks on Windows or X as it is, so I may be biased)
    Logan Capaldo, Sep 26, 2006
  17. I'm at a similar decision point. I don't have a Mac and don't plan to
    test on one, but I don't want to rule out Macs from using my
    application. My personal opinions:

    1. Tk is ugly, but it's a "de facto standard" and does come built-in.
    2. QT is the best looking, but the Ruby-QT4 bindings are still a tad
    unstable on my development platform (Gentoo Linux testing) and QT3 isn't
    open source on Windows.
    3. GTK is ugly -- IMHO uglier than Tk. Maybe I just haven't figured out
    how to make the fonts do what I want yet, but I can't stand the look of
    most GTK apps.
    4. JRuby -- I don't know much about it.
    5. FXRuby -- right now this is the front-runner. If I can get drag and
    drop to work from the examples that come with it, I'll probably settle
    on this one.

    The app I'm building will have a Dia/Visio/XFig/Inkscape-like "drag and
    drop shapes onto a canvas" GUI, but not a full diagramming package. I've
    actually considered using one of the open-source diagramming packages as
    a front end but I haven't found one that's Ruby-scriptable -- Python and
    Guile/Scheme appear to be the scripting languages of choice for such
    codes. :( If I go this way I'll have to have the diagramming package
    export XML or SVG and have the Ruby program execute it.

    Hmmm ... has anyone built a "GUI" using ruby-rsvg?
    M. Edward (Ed) Borasky, Sep 26, 2006
  18. IIRC QTDesigner runs on all platforms where QT itself runs, so you don't
    need a Linux development platform.

    I think you need QT4 if you want open source on Windows, though.
    M. Edward (Ed) Borasky, Sep 26, 2006
  19. Roman Hausner

    Dave Baldwin Guest

    On 26 Sep 2006, at 15:02, M. Edward (Ed) Borasky wrote:
    Google sketchup is a free drawing app that uses Ruby for plugins and
    general extensions. It is available for OSX and Windows, but not
    Linux, so may not be of interest to you.

    Dave Baldwin, Sep 26, 2006
  20. For what it's worth, there are a few examples already out there of
    using JRuby with SWT and Swing that look pretty nice. It's basically
    just Ruby code in the end, and works pretty well.

    I for one would really love to see some community effort to create a
    standard GUI library API that can be backed by whatever library,
    somewhat in the spirit of SWT. With such an API, we could have a Swing
    or SWT-backed implementation in JRuby, and MRI could use GTK, QT,
    win32, Cocoa, Fox, or whatever. GUI developers could build to the API,
    not to the library, and it would work anywhere.

    However I think Swing has shown that building a general GUI widget API
    is a difficult thing to get right, and everyone's going to have their
    own preferences.
    Charles O Nutter, Sep 26, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.