GUI With Ruby

Just a quick question: I’m sick of using Command Prompt for my little
Ruby programs, and I was wondering what can get me started? I know that
I can use Tk, but that isn’t very well documented in the Pickaxe.
Thanks!

Hi Yannick,

 Currently, there is no clear winner in the "GUI for Ruby" category. 

A
few of the possibilites that
I’m aware of are:

 Ruby + Qt
 Ruby + wxWidgets
 JRuby + Java Swing
 Ruby + TK
 Ruby on Rails + a copy of WebRick running locally (to purists, not

really a GUI, but to

pragmatists, may get you there faster than

learning a new toolkit)
Good luck.

Dennis

It depends alot on what you are most familiar with, and where you want
your
program to be able to run afterwards. All the ones I’ve mentioned above
have the advantage of being cross-platform. There are
some other possibilities mentioned in this article:

Chapter 2: GUI Toolkits for Ruby (Ruby Developer’s Guide, Syngress Publishing)

Finally, I’d suggest you just Google for “GUI for Ruby” and do some
exploring.

Thanks a lot for the hints! I’ll give Tk a bit of a try first up.

On 3/9/07, Yannick G. [email protected] wrote:

Just a quick question: I’m sick of using Command Prompt for my little
Ruby programs, and I was wondering what can get me started? I know that
I can use Tk, but that isn’t very well documented in the Pickaxe.
Thanks!

You might also want to take a look at FXRuby:

http://www.fxruby.org/

Hope this helps,

Lyle

FXRuby looks very interesting: any chance of there being an FXRuby book?

Forgive the double-post, but I was just wondering if there was a Ruby/Tk
book. If not, does anyone know of plans for one?

On 3/9/07, Yannick G. [email protected] wrote:

FXRuby looks very interesting: any chance of there being an FXRuby book?

Possibly someday, but not in the immediate future. For the time being,
you’d need to rely on the various online documentation sources at the
FOX home page:

http://www.fox-toolkit.org/

and the FXRuby home page:

http://www.fxruby.org/

There’s also some coverage of FXRuby in Hal F.'s book “The Ruby
Way.” (This is a good book to own even if you aren’t interested in
FXRuby!)

On 10/03/2007, at 1:22 PM, Yannick G. wrote:

FXRuby looks very interesting: any chance of there being an FXRuby
book?

There’s a qtRuby book available (PDF, for US$8.50)
http://www.pragmaticprogrammer.com/titles/ctrubyqt/

Is anyone able to give a quick rundown on which of these toolkits
will work on both Windows and OS X?
It’s not that clear from a number of the sites which platforms they
will work on. Some (like qt) seem Linux only. I don’t use Linux
but a mix os Win and OS X.

Cheers,
Dave

Sharon P. wrote:

It’s not that clear from a number of the sites which platforms they
will work on. Some (like qt) seem Linux only. I don’t use Linux
but a mix os Win and OS X.

Cheers,
Dave

Qt 4 Ruby works on Windows and Linux for sure. I don’t know about Macs,
though. I think most Mac users prefer native Mac GUIs anyhow, and there
is one for Ruby that has a very good reputation. I don’t have a Mac, so
I’ve forgotten the name.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

Yannick G. wrote:

Just a quick question: I’m sick of using Command Prompt for my little
Ruby programs, and I was wondering what can get me started? I know that
I can use Tk, but that isn’t very well documented in the Pickaxe.
Thanks!

In my humble opinion, QtRuby is by a wide margin the best documented
Ruby GUI. In addition to Caleb T.’ book directly concerning QtRuby,
all of the cool Qt gizmos, like Kommander and Korundum, QTDesigner and
all of the Qt documentation itself are available.


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

On 10/03/2007, at 3:56 PM, Aaron S. wrote:

for macs you can use RubyCocoa.

Thanks, just playing with it now. I like the idea of using interface
builder for building a gui, but I’m not that familiar with XCode -
I’ve worked my way through the example currency converter, that’s
all :slight_smile:

for macs you can use RubyCocoa.

I’ve been playing around with FXRuby, but I find that the tutorial is
more of a quick run-through more than a tutorial. It doesn’t explain
things in enough depth. I’ve tried Googling for one, but to no effect.
Does anybody know of a good tutorial for FXRuby along with a list of
classes and methods?

P.S. I’m quite new to Ruby, and I haven’t yet had the need to use a
“gem”. Would anyone be able to give me an explanation of exactly how
these “gems” work?

Yannick G. wrote:

I’ve been playing around with FXRuby, but I find that the tutorial is
more of a quick run-through more than a tutorial. It doesn’t explain
things in enough depth. I’ve tried Googling for one, but to no effect.
Does anybody know of a good tutorial for FXRuby along with a list of
classes and methods?
I’ve been learning FXRuby in the last two months, and you really just
have to dive in.
Pick something you want to make and start doing it. I started off using
foxguib, which helped me learn the way things are supposed to look, but
once you get started, it’s much more efficient, and you learn faster, to
code everything yourself.
I also keep the FXRuby and FOX websites open all the time. Having the
API docs on hand is a must.
Once you learn a little bit about how FXRuby works, go bach through the
tutorial, and look at all the example programs.
Things start to make a lot more sense then.

Raj S.

You might consider the Dashboard Widgets or Windows Gadgets as a
medium for a Ruby GUI as well, also incorporating Javascript. There
are application stub libraries for OS X, and likely the same for
Windows and Linux. All it means is embedding Ruby into another
language which handles the GUI and Ruby handles the core logic.
Possible, happens often with Python or Perl. But no matter which
approach you take, there is a whole library to learn. Using a web
browser and a web page as the front end locally could be a much
faster approach in terms of prototyping. Ruby should be able to make
any system calls you might make in another language. As for cross-
platform, success depends on how native the app looks and feels. Fact
is with a GUI, each platform is different enough that it isn’t
practical to write once and run everywhere, it ends up being like
Java, write once and debug everywhere.

Actually, Qt has gotten a lot better, and does work on Windows and
OS X and linux with claimed native look and feel.
Your mileage may vary and licensing is not free.

M. Edward (Ed) Borasky [email protected] wrote:

In my humble opinion, QtRuby is by a wide margin the best documented
Ruby GUI.

what about X-platform ?

i want to design over MacOS X and be, as much as possible, X-platform :
win* and *nix.

Qt 4 Ruby works on Windows and Linux for sure. I don’t know about
Macs, though. I think most Mac users prefer native Mac GUIs anyhow,
and there is one for Ruby that has a very good reputation. I don’t
have a Mac, so I’ve forgotten the name.

I’m using Qt4 QtRuby on the Mac and Linux wonderfully. I’ve started
diving into an attempt to build it on Windows, but honestly, using
Windows for software development is very frustrating for me.
However, it certainly is feasible to build and once someone does and
they share their library or routine for building it, we can safely
say it’s supported there as well.

Caleb

I’ve been learning FXRuby in the last two months, and you really
just have to dive in.

Agreed. FX and FXRuby are indeed great GUI toolkits (this coming
from a Qt guy). I simply started using Qt LONG before I ever picked
up Ruby, so QtRuby was a natural marriage for me.

Your mileage may vary.

Caleb

On 3/10/07, Yannick G. [email protected] wrote:

I’ve been playing around with FXRuby, but I find that the tutorial is
more of a quick run-through more than a tutorial. It doesn’t explain
things in enough depth. I’ve tried Googling for one, but to no effect.
Does anybody know of a good tutorial for FXRuby along with a list of
classes and methods?

The lack of tutorial-style documentation is indeed a problem. As far
as a list of classes and methods, there’s some pretty comprehensive
API documentation at the FXRuby web site. You know, the site that I
gave you a link to in my previous e-mail.