# Tk and Gtk

**URL:** <https://rubytalk.org/t/tk-and-gtk/1352>\
**Category:** ruby-talk\
**Created:** [22 August 2002 21:25 UTC](https://rubytalk.org/t/tk-and-gtk/1352 "2002-08-22T21:25:28Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Warning](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@Rob\_Warning](https://rubytalk.org/u/Rob_Warning)\
**Post date:** [22 August 2002 21:25 UTC](https://rubytalk.org/t/tk-and-gtk/1352/1 "2002-08-22T21:25:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sean\_Middleditch](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sean\_Middleditch](https://rubytalk.org/u/Sean_Middleditch)\
**Post date:** [22 August 2002 21:43 UTC](https://rubytalk.org/t/tk-and-gtk/1352/2 "2002-08-22T21:43:20Z")

</div>

> 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:
> 
> >

---

<div class="post-metadata">

**Author:** ![Harry\_Ohlsen2](https://avatars.discourse-cdn.com/v4/letter/h/958977/32.png) [@Harry\_Ohlsen2](https://rubytalk.org/u/Harry_Ohlsen2)\
**Post date:** [22 August 2002 21:46 UTC](https://rubytalk.org/t/tk-and-gtk/1352/3 "2002-08-22T21:46:13Z")

</div>

> … 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?

---

<div class="post-metadata">

**Author:** ![Lyle\_Johnson6](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@Lyle\_Johnson6](https://rubytalk.org/u/Lyle_Johnson6)\
**Post date:** [22 August 2002 22:37 UTC](https://rubytalk.org/t/tk-and-gtk/1352/4 "2002-08-22T22:37:19Z")

</div>

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:

- Conrad Schneiker’s “Summary Favoring GTK+”

- Kevin Smith’s “GTK vs. Tk”

- “Comparing GUI Toolkits” (with contributions from many)

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](http://www.fxruby.org)),  
the Ruby bindings for the FOX GUI toolkit ([http://www.fox-toolkit.org](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

---

<div class="post-metadata">

**Author:** ![Sean\_Middleditch](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sean\_Middleditch](https://rubytalk.org/u/Sean_Middleditch)\
**Post date:** [22 August 2002 21:51 UTC](https://rubytalk.org/t/tk-and-gtk/1352/5 "2002-08-22T21:51:27Z")

</div>

> > … 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:
> 
> >

---

<div class="post-metadata">

**Author:** ![Rob\_Warning](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@Rob\_Warning](https://rubytalk.org/u/Rob_Warning)\
**Post date:** [22 August 2002 22:28 UTC](https://rubytalk.org/t/tk-and-gtk/1352/6 "2002-08-22T22:28:07Z")

</div>

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 🙂 I use  
either GNOME or just Openbox. Since the program I’m planning is done  
just for Openbox, I (hopefully 😉 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:

---

<div class="post-metadata">

**Author:** ![KONTRA\_Gergely](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@KONTRA\_Gergely](https://rubytalk.org/u/KONTRA_Gergely)\
**Post date:** [13 September 2002 17:41 UTC](https://rubytalk.org/t/tk-and-gtk/1352/7 "2002-09-13T17:41:54Z")

</div>

> 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](http://hu.php.net)

---

<div class="post-metadata">

**Author:** ![Sean\_Middleditch](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sean\_Middleditch](https://rubytalk.org/u/Sean_Middleditch)\
**Post date:** [22 August 2002 22:33 UTC](https://rubytalk.org/t/tk-and-gtk/1352/8 "2002-08-22T22:33:31Z")

</div>

> 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 🙂 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 😉 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:
> 
> >

---

<div class="post-metadata">

**Author:** ![Michael\_Campbell1](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@Michael\_Campbell1](https://rubytalk.org/u/Michael_Campbell1)\
**Post date:** [22 August 2002 22:34 UTC](https://rubytalk.org/t/tk-and-gtk/1352/9 "2002-08-22T22:34:34Z")

</div>

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

> **···**
>
> — Sean Middleditch [elanthis@awesomeplay.com](mailto: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 🙂  
> > > 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: [Webspace nicht erreichbar](http://members.ud.com/projects/cancer/)
> 
> Yahoo IM: michael\_s\_campbell
> 
> * * *
> 
> Do You Yahoo!?  
> HotJobs - Search Thousands of New Jobs
> 
> > **[Monster Jobs - Job Search, Career Advice & Hiring Resources | Monster.com](https://www.monster.com/)**
> >
> > Monster is your source for jobs and career opportunities. Search for jobs, read career advice from Monster's job experts, and find hiring and recruiting advice.

---

<div class="post-metadata">

**Author:** ![Rob\_Warning](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@Rob\_Warning](https://rubytalk.org/u/Rob_Warning)\
**Post date:** [22 August 2002 22:39 UTC](https://rubytalk.org/t/tk-and-gtk/1352/10 "2002-08-22T22:39:37Z")

</div>

Sean Middleditch wrote

> > Openbox?

Think your favorite Blackbox clone. [http://openbox.sunsite.dk/](http://openbox.sunsite.dk/)

---

<div class="post-metadata">

**Author:** ![Kyle\_Rawlins](https://avatars.discourse-cdn.com/v4/letter/k/779978/32.png) [@Kyle\_Rawlins](https://rubytalk.org/u/Kyle_Rawlins)\
**Post date:** [23 August 2002 02:24 UTC](https://rubytalk.org/t/tk-and-gtk/1352/11 "2002-08-23T02:24:15Z")

</div>

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](http://mozilla.org)).  
If you think of tk as ugly, then I’d be careful about even looking at  
athena widgets 🙂

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

---

<div class="post-metadata">

**Author:** ![Sean\_Middleditch](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sean\_Middleditch](https://rubytalk.org/u/Sean_Middleditch)\
**Post date:** [22 August 2002 22:36 UTC](https://rubytalk.org/t/tk-and-gtk/1352/12 "2002-08-22T22:36:45Z")

</div>

> > 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/](http://members.ud.com/projects/cancer/)
> > 
> > Yahoo IM: michael\_s\_campbell
> > 
> > * * *
> > 
> > Do You Yahoo!?  
> > HotJobs - Search Thousands of New Jobs  
> > [http://www.hotjobs.com](http://www.hotjobs.com)

---

<div class="post-metadata">

**Author:** ![Sean\_Middleditch](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sean\_Middleditch](https://rubytalk.org/u/Sean_Middleditch)\
**Post date:** [22 August 2002 22:43 UTC](https://rubytalk.org/t/tk-and-gtk/1352/13 "2002-08-22T22:43:35Z")

</div>

> Sean Middleditch wrote
> 
> > > Openbox?
> 
> Think your favorite Blackbox clone. [http://openbox.sunsite.dk/](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:
> 
> >
