Tk and Gtk

Okay this isn’t exactly a ruby question, but in the near future I want
to do a GUI aplication in ruby. Now two obvious choices that come to
mind are tk and gtk. To me tk looks a bit dated (graphics wise not
functionally). For instance the new netscape browser look like it was
done with Tk (probably valid since Aol owns netscape and they seem to
love Tcl/Tk) and it looks kinda ugly. But it has pretty darned easy to
learn a great deal about it because I looked in the Perl/Tk book by
O’Reilly and it seems pretty straight forward translation from Perl to
Ruby. But GTK looks more modern (again graphics wise) and apealling to
the eye. Also the tutorial presented for Ruby/GTK is very helpfull. Plus
I have had a bit of experience with PHP-GTK (not enough to do much
usefull). My question is what are the major pros and cons of Tk and GTK.
Sorry if that was a bit off the ruby topic but I didn’t know where to ask.

Okay this isn’t exactly a ruby question, but in the near future I want
to do a GUI aplication in ruby. Now two obvious choices that come to
mind are tk and gtk. To me tk looks a bit dated (graphics wise not
functionally). For instance the new netscape browser look like it was
done with Tk (probably valid since Aol owns netscape and they seem to
love Tcl/Tk) and it looks kinda ugly. But it has pretty darned easy to
learn a great deal about it because I looked in the Perl/Tk book by
O’Reilly and it seems pretty straight forward translation from Perl to
Ruby. But GTK looks more modern (again graphics wise) and apealling to
the eye. Also the tutorial presented for Ruby/GTK is very helpfull. Plus
I have had a bit of experience with PHP-GTK (not enough to do much
usefull). My question is what are the major pros and cons of Tk and GTK.
Sorry if that was a bit off the ruby topic but I didn’t know where to ask.

Netscape is deinitely not done in Tk. ~,^

But, pros/cons (aside from Ruby specific ones):

Tk is more flexible by far. Tk is also a lot more portable than GTK+.

GTK+ does indeed look nicer. In most languages (Ruby’s I believe as
well) the GTK API is more like what you’d expect (All Tk interfaces I’ve
seen make the language look like TCL… gross ~,^).

In the end, it depends on a lot on preference and need. For example, if
you really don’t like the way Tk looks, then use GTK+. However, if you
need great portability (i.e., to non-UNIX platforms) you’re better off
staying away from GTK+. Personally, I’d always go with GTK+ (or full
GNOME) since that’s the desktop I run, and it makes it fit in. Which
brings up the fact you could use Qt if you are a KDE person.

The popular Ruby toolkit I see a lot of reference to is FOX. It’s a
nice C++ library (although it looks like Windows on all platforms, and
if you could see my desktop, you’d realize I’m not into that plain a
look ~,^). You may want to look at that toolkit tho.

···

On Thu, 2002-08-22 at 17:25, Robert Warning wrote:

… To me tk looks a bit dated (graphics wise not
functionally).

This is an interesting point. I’ve only written a couple of GUI programs, but
I found Ruby/Tk to be very functional, indeed. It’s just the look that’s
less than appealing, compare to other libraries.

Maybe I’m just being naive, but would it be possible, perhaps, for the visuals
of Tk to be updated to look like some of the more modern GUI libraries? That
would almost be enough for me to consider Ruby/Tk to be totally acceptable
for anything I’d like to write.

I realise, of course, that this is a job for the Tk people. I wonder if
there’s already work underway … or is Tcl/Tk stagnant at this stage?

Robert Warning wrote:

Okay this isn’t exactly a ruby question, but in the near future I want
to do a GUI aplication in ruby. Now two obvious choices that come to
mind are tk and gtk. To me tk looks a bit dated (graphics wise not
functionally). For instance the new netscape browser look like it was
done with Tk (probably valid since Aol owns netscape and they seem to
love Tcl/Tk) and it looks kinda ugly.

Actually, Netscape (a.k.a. Mozilla) is using its own
platform-independent GUI toolkit (XUL).

But it has pretty darned easy to
learn a great deal about it because I looked in the Perl/Tk book by
O’Reilly and it seems pretty straight forward translation from Perl to
Ruby. But GTK looks more modern (again graphics wise) and apealling to
the eye. Also the tutorial presented for Ruby/GTK is very helpfull. Plus
I have had a bit of experience with PHP-GTK (not enough to do much
usefull). My question is what are the major pros and cons of Tk and GTK.
Sorry if that was a bit off the ruby topic but I didn’t know where to ask.

Regular readers of the comp.lang.ruby newsgroup know what I’m going to
get around to eventually, so let me start by presenting some less-biased
links from the RubyGarden Wiki:

Although all three of these pages are a bit old by now, most of the
comments you’ll see in them still apply. As you’ve noted, the general
consensus about Tk is that:

  • it is very cross-platform, with ports to Mac OS as well as Windows and
    Linux;
  • it is very well-documented (if not for Ruby/Tk specifically, at least
    for Perl/Tk);
  • its look is pretty dated

As for GTK+, the big sticking point seems to be the wobbly support for
Windows. This was supposed to have improved for the GTK+ 2.0 release but
I get the impression that nothing’s changed; the Windows version still
seems to be a second-class citizen with one person doing the job. But I
don’t use it regularly and I may be way off on this assessment.

You don’t mention which platform(s) you’re targeting for your
application. If you’re only targeting Linux (well, let’s instead say
"X-Windows platforms") and you’re already familiar with GTK+ from other
environments it seems like an obvious choice: go with Ruby/GTK. It seems
to be pretty well-maintained. If you know that you’ll need to run your
application on Mac OS eventually, go with Ruby/Tk instead.

A more recent arrival on the scene is FXRuby (http://www.fxruby.org),
the Ruby bindings for the FOX GUI toolkit (http://www.fox-toolkit.org).
I am very biased because this is the project I’m working on. But, as it
turns out, a lot of people have found it to be a good alternative to
Ruby/Tk and Ruby/GTK for a number of reasons. It has a very modern
look-and-feel and is actively supported for both Windows and Linux/X.
The number one biggest problem (IMO) is the shortage of documentation.

Hope this helps,

Lyle

… To me tk looks a bit dated (graphics wise not
functionally).

This is an interesting point. I’ve only written a couple of GUI programs, but
I found Ruby/Tk to be very functional, indeed. It’s just the look that’s
less than appealing, compare to other libraries.

Maybe I’m just being naive, but would it be possible, perhaps, for the visuals
of Tk to be updated to look like some of the more modern GUI libraries? That
would almost be enough for me to consider Ruby/Tk to be totally acceptable
for anything I’d like to write.

I realise, of course, that this is a job for the Tk people. I wonder if
there’s already work underway … or is Tcl/Tk stagnant at this stage?

I was thinking the same thing. The problem arises I think in how
flexible Tk is; the way you can already change the styles of many Tk
widgets around. An app that wasn’t written for “modern Tk” or (drool)
“themable Tk” might look like complete and total ^&*$ given that version
of Tk.

···

On Thu, 2002-08-22 at 17:46, Harry Ohlsen wrote:

Sean Middleditch wrote:

Okay this isn’t exactly a ruby question, but in the near future I want
to do a GUI aplication in ruby. Now two obvious choices that come to
mind are tk and gtk. To me tk looks a bit dated (graphics wise not
functionally). For instance the new netscape browser look like it was
done with Tk (probably valid since Aol owns netscape and they seem to
love Tcl/Tk) and it looks kinda ugly. But it has pretty darned easy to
learn a great deal about it because I looked in the Perl/Tk book by
O’Reilly and it seems pretty straight forward translation from Perl to
Ruby. But GTK looks more modern (again graphics wise) and apealling to
the eye. Also the tutorial presented for Ruby/GTK is very helpfull. Plus
I have had a bit of experience with PHP-GTK (not enough to do much
usefull). My question is what are the major pros and cons of Tk and GTK.
Sorry if that was a bit off the ruby topic but I didn’t know where to ask.

Netscape is deinitely not done in Tk. ~,^

But, pros/cons (aside from Ruby specific ones):

Tk is more flexible by far. Tk is also a lot more portable than GTK+.

GTK+ does indeed look nicer. In most languages (Ruby’s I believe as
well) the GTK API is more like what you’d expect (All Tk interfaces I’ve
seen make the language look like TCL… gross ~,^).

In the end, it depends on a lot on preference and need. For example, if
you really don’t like the way Tk looks, then use GTK+. However, if you
need great portability (i.e., to non-UNIX platforms) you’re better off
staying away from GTK+. Personally, I’d always go with GTK+ (or full
GNOME) since that’s the desktop I run, and it makes it fit in. Which
brings up the fact you could use Qt if you are a KDE person.

The popular Ruby toolkit I see a lot of reference to is FOX. It’s a
nice C++ library (although it looks like Windows on all platforms, and
if you could see my desktop, you’d realize I’m not into that plain a
look ~,^). You may want to look at that toolkit tho.

Well netscape sure looks like Tk ugliness (down to the menus checkboxes
and that silly scollbar) to me even if it was not done in Tk :slight_smile: I use
either GNOME or just Openbox. Since the program I’m planning is done
just for Openbox, I (hopefully :wink: won’t have a portability problem. Even
if one is a non Gnome user most boxes I’ve encountered have GTK+ on
them. Oh well I think I’m going to use GTK rather than Tk and I’ll look
into FOX too. GTK mainly because I can emulate the Openbox look and feel
better than Tk.

···

On Thu, 2002-08-22 at 17:25, Robert Warning wrote:

Ruby/Tk and Ruby/GTK for a number of reasons. It has a very modern
look-and-feel and is actively supported for both Windows and Linux/X.
Ehh? modern look-and-feel? What about the combobox and the slider? They
look as if they’re tk widgets.

Besides the fox library is 4 Megs, which is too large, isn’t it?

Gergo

±[Kontra, Gergely @ Budapest University of Technology and Economics]-+

    Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |

URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
±------“Olyan langesz vagyok, hogy poroltoval kellene jarnom!”-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net

Well netscape sure looks like Tk ugliness (down to the menus checkboxes
and that silly scollbar) to me even if it was not done in Tk :slight_smile: I use

Oh, wait, are you talking about ancient Netscape? I’m thinking current
Netscape. ^,^ Old Netscape was done in Athena or something like that;
the widget set Tk got its inspiration from.

either GNOME or just Openbox. Since the program I’m planning is done
just for Openbox, I (hopefully :wink: won’t have a portability problem. Even

Openbox?

if one is a non Gnome user most boxes I’ve encountered have GTK+ on
them. Oh well I think I’m going to use GTK rather than Tk and I’ll look
into FOX too. GTK mainly because I can emulate the Openbox look and feel
better than Tk.

Ah. Every UNIX system I’ve seen has had Tk. Almost every Linux system
has GTK+ (even the KDE-only ones, thanks to the popularity of the
GIMP). I guess more and more UNIX’s have GTK now as well. FOX isn’t
installed by default on any system I’ve seen to date, tho…

If you wanted real portability, maybe there is an Xlib module for
Ruby… ~,^ That would be… interesting.

···

On Thu, 2002-08-22 at 18:28, Robert Warning wrote:

Current Netscape seems far too slow for TK too. =)

···

— Sean Middleditch elanthis@awesomeplay.com wrote:

On Thu, 2002-08-22 at 18:28, Robert Warning wrote:

Well netscape sure looks like Tk ugliness (down to the menus
checkboxes
and that silly scollbar) to me even if it was not done in Tk :slight_smile:
I use

Oh, wait, are you talking about ancient Netscape? I’m thinking
current
Netscape. ^,^ Old Netscape was done in Athena or something like
that;
the widget set Tk got its inspiration from.

=====

Use your computer to help find a cure for cancer: http://members.ud.com/projects/cancer/

Yahoo IM: michael_s_campbell


Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

Sean Middleditch wrote

Openbox?

Think your favorite Blackbox clone. http://openbox.sunsite.dk/

Netscape 4 on unix was motif. I’m pretty sure all earlier netscape/unix
versions have been in fact. netscape 6-7 are XUL (see mozilla.org).
If you think of tk as ugly, then I’d be careful about even looking at
athena widgets :slight_smile:

-kyle

···

On Fri, Aug 23, 2002 at 07:33:31AM +0900, Sean Middleditch wrote:

Oh, wait, are you talking about ancient Netscape? I’m thinking current
Netscape. ^,^ Old Netscape was done in Athena or something like that;
the widget set Tk got its inspiration from.

Oh, wait, are you talking about ancient Netscape? I’m thinking
current
Netscape. ^,^ Old Netscape was done in Athena or something like
that;
the widget set Tk got its inspiration from.

Current Netscape seems far too slow for TK too. =)

Heh. Thank the gods for Galeon. ^,^

···

On Thu, 2002-08-22 at 18:34, Michael Campbell wrote:

=====

Use your computer to help find a cure for cancer: http://members.ud.com/projects/cancer/

Yahoo IM: michael_s_campbell


Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

Sean Middleditch wrote

Openbox?

Think your favorite Blackbox clone. http://openbox.sunsite.dk/

Oh. I didn’t know I had a favorite Blackbox clone. ^,^ Only one I’d
ever used was Fluxbox. Still like GNOME better tho. Consistant look in
all my apps, VFS layer, embedding, etc… very slick. ~,^

Although, granted, now that FreeDesktop has things like the XEmbed
protocol and such, perhaps this doesn’t matter beyond the looks
issues…

···

On Thu, 2002-08-22 at 18:39, Robert Warning wrote: