From: Lyle Johnson Date: 2002-08-23T07:37:19+09:00 Subject: Re: Tk and Gtk 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+" http://www.rubygarden.org/ruby?SummaryFavoringGTK * Kevin Smith's "GTK vs. Tk" http://www.rubygarden.org/ruby?GTKvsTk * "Comparing GUI Toolkits" (with contributions from many) http://www.rubygarden.org/ruby?ComparingGuiToolkits 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