GUI programming for WinXP/Linux/OSX?

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
missed
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
system
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.

···

--
Posted via http://www.ruby-forum.com/.

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

- it must run on WinXP and Linux, idally also on OSX

Tk, then.

- it must have a GUI preferably with the GUI's native widget set

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.

- it must allow scripting access to system resources with a modern and
  comfortable scripting language

Can you expand on that? What you're describing here is separate from
the GUI, or should be.

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
missed
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
system

Again, Tk ships with Ruby, and works on Windows, so...

-- Thomas Adam

···

On Tue, 26 Sep 2006 16:58:07 +0900 Roman Hausner <roman.hausner@gmail.com> wrote:

Roman Hausner wrote:

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

Perhaps wxRuby http://wxruby.rubyforge.org/wiki/wiki.pl will help.

Roman Hausner wrote:

/ ...

If at all possible, I would prefer to do it all in Ruby though.

Recently I have been writing some apps using Ruby and the Qt library. The Qt
library is available under the GPL for Linux, Windows and OS X. I much
prefer the Qt library over Tk -- IMHO it is better-looking and has more
useful components.

I develop under Linux, where there is a Qt GUI designer application called
"Qt Designer" (the executable is named "designer"), which is pretty good.

Here are two examples of my recent Ruby/Qt apps:

http://www.arachnoid.com/ruby/graphinity/index.html

http://www.arachnoid.com/ruby/gravity/index.html

Here's a link to the Qt download site (scroll down to the section marked "Qt
Open Source Downloads"):

http://www.trolltech.com/products/qt/downloads

I think this deserves a look.

···

--
Paul Lutus
http://www.arachnoid.com

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.

Roman Hausner wrote:

···

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
missed
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
system
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.

--
Posted via http://www.ruby-forum.com/\.

mmmkay ... :slight_smile:

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 (http://www.fxruby.org/)
  (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.

···

--
Posted via http://www.ruby-forum.com/.

see also Screenshots - wxWidgets

···

On Tue, 2006-09-26 at 16:58 +0900, Roman Hausner wrote:

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
missed
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
system
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.

Try wxPython: www.wxpython.org

Fits on all your requests, and is very mature.

Roman Hausner ha escrito:

···

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

In article <de492f88796131ca71ed429a10ead863@ruby-forum.com>,

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
missed some things. Can anyone tell me if there is a common
(portable) way to

The cross-platform GUI solutions tend to have little (or big!)
deviations from the normal native GUI application behavior on one or
more of their supported platforms. It often turns out to be worth it to
separate the GUI from the rest of your project, and then you can do the
GUI separately on each platform using whatever tools you would use if
that was the ONLY platform you had to support, and do the rest of your
project in whatever you want (e.g., Ruby), because the users will never
have to see it.

At first, this sounds like about 4 times as much work, as you are doing
your project's code, plus three separate GUIs. However, the GUIs should
be pretty simple.

If you make the GUI and the rest of the project communicate using some
kind of RPC over TCP, you even get, for pretty much free, the ability to
have the GUI remote.

···

Roman Hausner <roman.hausner@gmail.com> wrote:

--
--Tim Smith

Thomas Adam wrote:

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

- it must run on WinXP and Linux, idally also on OSX

Tk, then.

- it must have a GUI preferably with the GUI's native widget set

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.

- it must allow scripting access to system resources with a modern and
  comfortable scripting language

Can you expand on that? What you're describing here is separate from
the GUI, or should be.

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
missed
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
system

Again, Tk ships with Ruby, and works on Windows, so...

-- Thomas Adam

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
Swing.
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
etc.

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

···

On Tue, 26 Sep 2006 16:58:07 +0900 > Roman Hausner <roman.hausner@gmail.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

+1

Among cross platform environments QT is the one that better looks on
MacOS X. If MacOS X is the concern.

···

Paul Lutus <nospam@nosite.zzz> wrote:

Recently I have been writing some apps using Ruby and the Qt library. The Qt
library is available under the GPL for Linux, Windows and OS X. I much
prefer the Qt library over Tk -- IMHO it is better-looking and has more
useful components.

--
blog: http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site: http://www.akropolix.net/rik0/ | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.

Roman Hausner wrote:

mmmkay ... :slight_smile:

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 (http://www.fxruby.org/\)
  (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.

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. :frowning: 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?

Paul Lutus wrote:

Roman Hausner wrote:

/ ...

If at all possible, I would prefer to do it all in Ruby though.

Recently I have been writing some apps using Ruby and the Qt library. The Qt
library is available under the GPL for Linux, Windows and OS X. I much
prefer the Qt library over Tk -- IMHO it is better-looking and has more
useful components.

I develop under Linux, where there is a Qt GUI designer application called
"Qt Designer" (the executable is named "designer"), which is pretty good.

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.

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.

···

On 9/26/06, Roman Hausner <roman.hausner@gmail.com> wrote:

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 (http://www.fxruby.org/\)
  (non-native widgetset).

--
Contribute to RubySpec! @ Welcome to headius.com
Charles Oliver Nutter @ headius.blogspot.com
Ruby User @ ruby.mn

is that working on Mac OS X, any experiment ???

···

Reid Thompson <Reid.Thompson@ateb.com> wrote:

see also Screenshots - wxWidgets

--
une bévue

Reid Thompson wrote:

···

On Tue, 2006-09-26 at 16:58 +0900, Roman Hausner wrote:

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 missed
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 system
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.

see also Screenshots - wxWidgets

My vote goes for wxWidgets. Which there are ruby bindings I believe. wxWidgets translate to native bindings. Or at least they should.
Check out their site: http://www.wxwidgets.org/

Ruby bindings: http://wxruby.rubyforge.org/wiki/wiki.pl

[snip]

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 (http://www.fxruby.org/\)
  (non-native widgetset).

And probably wxRuby too.

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.

Here are some pretty general guidelines that I follow:

1. Browse around the various project's mailing lists. See which ones
you think tend to be the most helpful. Note, more mature toolkits with
good docs may be less active, but you can still see if user questions
are getting answered.

2. Have a look at the project's docs. Whichever toolkit you go with,
you'll be spending a lot of time with their docs.

3. Have a look at the project's various sample programs. The simpler
ones are often just a page of code. Then maybe look for some sample
code that uses a feature you know you'll be using, and see what you
think.

4. Finally, if they come with a GUI builder tool (like GTK's Glade),
you might try it out. Could save you a lot of time.

Note, re. GTK+ on Mac OS X:
http://developer.imendio.com/projects/gtk-macosx . The project still
seems to be moving along.

---John

···

On 9/26/06, Roman Hausner <roman.hausner@gmail.com> wrote:

Tim Smith wrote:

The cross-platform GUI solutions tend to have little (or big!)
deviations from the normal native GUI application behavior on one or
more of their supported platforms. It often turns out to be worth it to
separate the GUI from the rest of your project, and then you can do the
GUI separately on each platform using whatever tools you would use if
that was the ONLY platform you had to support, and do the rest of your
project in whatever you want (e.g., Ruby), because the users will never
have to see it.

At first, this sounds like about 4 times as much work, as you are doing
your project's code, plus three separate GUIs. However, the GUIs should
be pretty simple.

If you make the GUI and the rest of the project communicate using some
kind of RPC over TCP, you even get, for pretty much free, the ability to
have the GUI remote.

Or use Rails and make a browser-based GUI with Ajax.

Roman Hausner wrote:

···

Roman Hausner <roman.hausner@gmail.com> wrote:
[.. gui, native, winxp, linux, osx .. ]

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: http://www.jvoorhis.org/articles/2006/09/10/hello-jruby

Cheers
Mariano

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 Swing.
Tk looks alien on all systems and it looks a lot more alien that
Java Swing.

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).

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 etc.

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
sets.

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

Nope. It's a case of try one and see.

-- Thomas Adam

···

On Tue, 26 Sep 2006 17:11:28 +0900 Roman Hausner <roman.hausner@gmail.com> wrote: