FXRuby versus Tk

I’ve done some GUI program with Ruby/Tk, and am able to use it fairly
well, but am considering a switch to FXRuby. Can someone give me a
comparison of the two and provide me with a reason to either switch to
FXRuby or stay with Ruby/Tk? I’m interested in which is more powerful,
easier to use, better documented, etc.

Thanks,

Alex

On Wed, Apr 9, 2008 at 2:40 PM, Alex DeCaria
[email protected] wrote:

I’ve done some GUI program with Ruby/Tk, and am able to use it fairly
well, but am considering a switch to FXRuby. Can someone give me a
comparison of the two and provide me with a reason to either switch to
FXRuby or stay with Ruby/Tk? I’m interested in which is more powerful,
easier to use, better documented, etc.

Claims about which GUI toolkit (or programming language, or text
editor, …) is more powerful, easier to use and better documented are
highly subjective. My advice in situations like this is to go ahead
and try out FXRuby for a few simple things, and decide for yourself
which one you like better. As long as you’re shopping around, you
might also want to try out some of the other popular GUI toolkits for
Ruby, like Ruby/GTK, QtRuby and wxRuby.

You don’t say why it is that you’re considering a switch from Ruby/Tk,
and so I’m not quite sure how to answer your question. FXRuby is
“powerful” in the sense that it’s backed up by FOX, a highly optimized
and resource friendly GUI library written in C++. Like most
non-trivial libraries, with a large number of classes and methods and
so forth, it can be non-easy to get started with. The API
documentation is pretty thorough, there are a handful of tutorials at
the FXRuby web site, and a FXRuby book
(http://www.pragprog.com/titles/fxruby/) is available to help people
get started with FXRuby programming.

Hope this helps,

Lyle

Lyle,

Thanks. My disenchantment with Ruby/Tk has to do with the fact that the
main documentation I have is for Perl/Tk, and trying to translate that
for use with Ruby was painful, and involved a lot of trial and error.
FXRuby appeals to me because it sounds like there is actual
documentation for it directly for use with Ruby.

I’m also concerned with portability. If I write a nice app that I want
to share with someone else, and if they are not a knowledgable computer
user, which GUI library would be easier for me to talk them into
installing on their machine so they can run my application? Am I
correct in thinking that FXRuby comes as part of the Windows 1-click
installer? That would be an advantage.

Alex

I’m interested in which is more powerful, easier to use, better documented, etc.

Personally I am using ruby-gtk (because of the wiki back then), and on
my current agenda is also to slowly add new knowledge to Ruby-qt so that
I can use this. (I think ruby-qt4 looks very decent.)

[I also try to never tie components to one particular toolkit, so that I can quickly switch to other toolkits if need be.]

The biggest decisive factor for me back then was the documentation, and
the ruby-gtk wiki was superior therein to all the other toolkits IMO -
and I hope Lyle will implement some kind of wiki one day specifically
for FXRuby. :slight_smile:
(The kde wiki guy for example approved my suggestion to start a kde-wiki
project for ruby-qt by the way, I just have not started it yet because I
really
lack the time these days. But maybe the Fox creator can do something
there.)

Anyway, FXRuby has one big thing going for it - this is Lyle! :slight_smile:

(I mean this seriously by the way, a driving and knowledeable “force”
is of invaluable help in the long run. I have noticed this myself when I
needed help with RMagick, and the RMagick maintainer helped me a lot.)

Am I correct in thinking that FXRuby comes as part of the Windows 1-click
installer? That would be an advantage.
I am not sure, it could be that the user has to install it lateron. But
to be honest such a problem should be overcome rather quickly in an
automatic way, and if it is windows specific, maybe the windows folks
manage to either allow “hooks” (so that windows folks can distribute
their flavoured version of windows install components, i.e. you could
add Fox to that list easily) or allow a “big distribution” of various
components together, where one can select what he needs.

On Wed, Apr 9, 2008 at 4:15 PM, Alex DeCaria
[email protected] wrote:

Thanks. My disenchantment with Ruby/Tk has to do with the fact that the
main documentation I have is for Perl/Tk, and trying to translate that
for use with Ruby was painful, and involved a lot of trial and error.
FXRuby appeals to me because it sounds like there is actual
documentation for it directly for use with Ruby.

Yes, there is actual documentation for using FXRuby with Ruby. :wink:

I’m also concerned with portability. If I write a nice app that I want
to share with someone else, and if they are not a knowledgable computer
user, which GUI library would be easier for me to talk them into
installing on their machine so they can run my application? Am I
correct in thinking that FXRuby comes as part of the Windows 1-click
installer? That would be an advantage.

FXRuby is indeed included in the one-click installer for Windows. It’s
also available as a binary gem for Windows and Mac OS X (Leopard),
which means that installation on those platforms is relatively
painless. Rather than trying to provide binary gems for the myriad
options in the Linux world (so many different OS/compiler/Ruby
versions), we currently depend on building the code there from source.
But it’s certainly portable in the sense that it works on most
operating systems.

On Wed, Apr 9, 2008 at 4:27 PM, Marc H. [email protected]
wrote:

[I also try to never tie components to one particular toolkit, so that I can quickly switch to other toolkits if need be.]

This may be the most important piece of advice to take away from this
thread. :wink:

The biggest decisive factor for me back then was the documentation, and
the ruby-gtk wiki was superior therein to all the other toolkits IMO -
and I hope Lyle will implement some kind of wiki one day specifically
for FXRuby. :slight_smile:

In the past, I’ve posted stuff on the FOX Community Wiki (at
http://www.fox-toolkit.net/), but it might be nice to have a dedicated
Wiki for FXRuby. The default option for Wikis on RubyForge-hosted
sites is (was?) UseMod, and it was such a spam magnet that it was
basically unusable. Not sure if that situation has changed, but if it
hasn’t, I’d need to look for some alternative location to host such a
Wiki.

On Thu, 2008-04-10 at 06:15 +0900, Alex DeCaria wrote:

I’m also concerned with portability. If I write a nice app that I want
to share with someone else, and if they are not a knowledgable computer
user, which GUI library would be easier for me to talk them into
installing on their machine so they can run my application? Am I
correct in thinking that FXRuby comes as part of the Windows 1-click
installer? That would be an advantage.

Windows-wise, I wonder if rubyscript2exe:

http://www.erikveen.dds.nl/rubyscript2exe/

would do the trick. Does it also gather up all the native dependencies?
If so, maybe it’ll pull together FOX and the FxRuby bindings and provide
you with a nice exe that folks can just run without even needing to
install Ruby…

Yours,

Tom

On 4/9/08, Lyle J. [email protected] wrote:

FXRuby is indeed included in the one-click installer for Windows. It’s
also available as a binary gem for Windows and Mac OS X (Leopard),
which means that installation on those platforms is relatively
painless.

Seeing the announcement of the book I thought I’d take another look at
Fox. In the past I’d always hit installation problems with Fox so the
binary gem sounded promising.

I installed the current gem (fxruby (1.6.14)) but:

Siona:~ matt$ irb

require ‘rubygems’
=> false

require ‘fox16’
/opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.14-universal-darwin-9/ext/fox16/fox16.bundle:
[BUG] Bus Error
ruby 1.8.6 (2007-09-23) [i686-darwin9.1.0]

Abort trap
Siona:~ matt$

This is 10.5.2 with ports ruby:

Siona:~ matt$ ruby -v
ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-darwin9.1.0]

Regards,

Matt

On 4/9/08, Tom C. [email protected] wrote:

http://www.erikveen.dds.nl/rubyscript2exe/

would do the trick. Does it also gather up all the native dependencies?
If so, maybe it’ll pull together FOX and the FxRuby bindings and provide
you with a nice exe that folks can just run without even needing to
install Ruby…

Yes, this works well (although the executable can get large).
I created a flash-card quiz program as a stand-alone Windows
executable using FxRuby, RMagic and rubyscript2exe.

-Adam

On Apr 10, 2008, at 2:23 AM, Matt M. wrote:

Seeing the announcement of the book I thought I’d take another look at
Fox. In the past I’d always hit installation problems with Fox so the
binary gem sounded promising.

I installed the current gem (fxruby (1.6.14)) but:

This is 10.5.2 with ports ruby:

Siona:~ matt$ ruby -v
ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-darwin9.1.0]

Right, the gem is intended for use with Apple’s built-in Ruby for
Leopard. If you’re using MacPorts, however, I’d recommend just
installing the port for FXRuby:

sudo port install rb-fxruby

Hope this helps,

Lyle


“FXRuby: Create Lean and Mean GUIs with Ruby”
Now available from the Pragmatic Bookshelf!
http://www.pragprog.com/titles/fxruby

On Apr 10, 8:51 am, Lyle J. [email protected] wrote:

This is 10.5.2 with ports ruby:
Hope this helps,

Lyle


“FXRuby: Create Lean and Mean GUIs with Ruby”
Now available from the Pragmatic Bookshelf!http://www.pragprog.com/titles/fxruby

It seems as the more things change…you know the cliche. Back around
2003 or so I was trying to create production GUI apps using Ruby. I
used (and still use) Ruby for a myriad of headless scripted apps. But
for GUI apps I was left between Qt, Fox, Tk, Wx, and a few other more
obscure toolkits (Widestudio e.g.). Besides the OO feel of the
respective options one of the deciding factors was the availability of
Ruby-specific English documentation. Back then I had to choose between
deciphering Qt method calls into Ruby, interpreting Tk documentation
for Ruby originally written in Japansese or else translating English
docs meant for Python, etc.

Don’t get me wrong. Out of most all of the languages I’ve worked with
I prefer to use Ruby for my “quick and dirty” work. But for RAD GUI
development I still haven’t found a drag and drop widget solution that
comes close to Microsoft Visual Studio. Albeit using C# is like
working with your hands tied behind your back compared to Ruby. If
there’s something out there for Ruby that comes close now I’d love to
see it.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

M. Edward (Ed) Borasky wrote:

| In the Linux world, there’s KDevelop/Korundum/Kommander, all built on
| top of Qt/QtDesigner. But I don’t know how portable an app built with
| that toolset would be to Windows or a Mac.

KDE apps aren’t portable to “pute” Qt, as I understand it.

However, KDE4 libraries for Windows are being worked on (or were as of
last year…).


Phillip G.
Twitter: twitter.com/cynicalryan

Follow each decision as closely as possible with its associated action.
~ - The Elements of Programming Style (Kernighan & Plaugher)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf+2m0ACgkQbtAgaoJTgL9fpACeJjekiLYK+qYtOG4AQRVdmU0e
jrwAnA0bfIHOojmjvzuyWLVcca8gcG6U
=Smrr
-----END PGP SIGNATURE-----

M. Edward (Ed) Borasky wrote:

In the Linux world, there’s KDevelop/Korundum/Kommander, all built on
top of Qt/QtDesigner. But I don’t know how portable an app built with
that toolset would be to Windows or a Mac.

I think Qt is on windows now, and with the Trolltech/Nokia merger Qt
probably will be pretty widespread.

The big advantage (for some uses) of FXRuby is the license. Unless
things have changed recently, it’s LGPL for FXRuby vs. GPL/$$$ for Qt.

I’ve found FXRuby to be a really nice layer to build Gui DSLs on top of.
Who needs drag-and-drop UI builders.

TkRuby is useful for its Canvas widget, among other things. I’ve never
found a better way to quickly produce 2D animations that also have
complex user interactions (not just click, drag, drop, but even embedded
widgets).

gregarican wrote:

Siona:~ matt$ ruby -v

Ruby-specific English documentation. Back then I had to choose between
see it.
In the Linux world, there’s KDevelop/Korundum/Kommander, all built on
top of Qt/QtDesigner. But I don’t know how portable an app built with
that toolset would be to Windows or a Mac.

up

visit a rubyonrails website :http://www.rorchina.net
wolf union program club :http://wolf.rorchina.net
China Rubyonrails club: http:bbs.rorchina.net

Hi Lyle.

On 4/10/08, Lyle J. [email protected] wrote:

Right, the gem is intended for use with Apple’s built-in Ruby for Leopard.
If you’re using MacPorts, however, I’d recommend just installing the port
for FXRuby:

    sudo port install rb-fxruby

Thanks for the advice. I confess I wasn’t entirely surprised when the
rb-fxruby port didn’t work for me:

—> Building rb-fxruby with target setup
Error: Target org.macports.build returned: shell command " cd
“/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_ruby_rb-fxruby/work/FXRuby-1.6.13”
&& /opt/local/bin/ruby -rvendor-specific install.rb setup " returned
error 1
Command output: cc -dynamic -bundle -undefined suppress
-flat_namespace -o fox16.bundle librb.o core_wrap.o dc_wrap.o
dialogs_wrap.o frames_wrap.o fx3d_wrap.o FXRbApp.o FXRbDataTarget.o
FXRbGLViewer.o FXRuby.o iconlist_wrap.o icons_wrap.o image_wrap.o
impl.o label_wrap.o layout_wrap.o list_wrap.o markfuncs.o mdi_wrap.o
menu_wrap.o scintilla_wrap.o table_wrap.o text_wrap.o treelist_wrap.o
ui_wrap.o unregisterOwnedObjects.o -L"." -L"/opt/local/lib"
-L"/opt/local/lib" -L"/usr/X11R6/lib" -L. -L/opt/local/lib -lruby
-lfxscintilla -lFOX-1.6 -lGLU -lGL -lX11 -lXext -ltiff -ljpeg -lz
-lpng -lstdc++ -lpthread -ldl -lobjc
i686-apple-darwin9-gcc-4.0.1: core_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: dc_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: dialogs_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: frames_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: fx3d_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: FXRbApp.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: FXRbDataTarget.o: No such file or
directory
i686-apple-darwin9-gcc-4.0.1: FXRbGLViewer.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: FXRuby.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: iconlist_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: icons_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: image_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: impl.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: label_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: layout_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: list_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: markfuncs.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: mdi_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: menu_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: scintilla_wrap.o: No such file or
directory
i686-apple-darwin9-gcc-4.0.1: table_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: text_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: treelist_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: ui_wrap.o: No such file or directory
i686-apple-darwin9-gcc-4.0.1: unregisterOwnedObjects.o: No such file
or directory
make: *** [fox16.bundle] Error 1
setup failed
'system make ’ failed
Try ‘ruby install.rb --help’ for detailed usage.

I’m just reporting this FYI because I’m not planning to spend any more
time on this; I was only going to noodle about with Fox anyway and
messing with broken ports isn’t my idea of fun.

If I ever switch to Leopard Ruby I will be sure to give your binary gem
a whirl.

Regards,

Matt

On Fri, Apr 11, 2008 at 3:07 AM, Matt M. [email protected]
wrote:

Thanks for the advice. I confess I wasn’t entirely surprised when the
rb-fxruby port didn’t work for me:

Yes, that’s due to a bug in the ruby port you’re using. Trying doing:

sudo port sync

to pull down the latest ports metadata, and then:

sudo port update ruby

And finally,

sudo port install rb-fxruby

I’m just reporting this FYI because I’m not planning to spend any more
time on this; I was only going to noodle about with Fox anyway and
messing with broken ports isn’t my idea of fun.

I understand. MacPorts is great when it works, but it’s sort of a
nightmare trying to support it. I like the idea of MacPorts building
things from source, but when your dependencies get out of whack it can
be a difficult problem to diagnose. There’s something to be said for
the all-binaries packaging approach that most package managers take,
where someone else has already compiled the code and you have a better
shot of it working right off the bat. :wink:

If I ever switch to Leopard Ruby I will be sure to give your binary gem a whirl.

Great!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs