Tk is my favorite GUI toolkit

Cross-platform user interface stays fresh

By Cameron Laird  2 comments

I like to program graphical user interfaces (GUIs) with Tk; it's one of my two favorite GUI toolkits. I'll give several tips about GUI construction with Tk. I suspect at last some of this will apply to you. Next week, "Smart Development" will do the same for my other favorite GUI toolkit.

Understand, first, that a posting like this can achieve no more than a few tips. As much as I appreciate clarity and simplicity, a majority of the writing on programming that people apparently find persuasive is woefully truncated. Look, for a quick example, at Tk 8.5 is better than wxWidgets on Windows". Author BIOSPUD writes well, in that he clearly explains himself: he explains his focus on cross-platform capabilities (where Tk does indeed shine), he lucidly describes the dimensions along which he compares Tk, Swing, and wxWindows, he specifies crucial details (such as release number), and so on.

And he still covers only a small fraction of what there is to know. My impression of BIOSPUD is that he's aware of this. I've heard readers react to such articles, though, and they seem to internalize a post like his as, "Tk roolz!", without recognition that:

  • the comparison doesn't touch on such important toolkits as Qt, GTK, and .NET;
  • Tk has already moved on to 8.6 for production, wxWidgets has development snapshots at 2.9.0, and so on;
  • there's no discussion of performance or features;
  • there's little mention of the compatibility of the toolkits with different languages;

and so on. Modern toolkits are big, highly-evolved constructions, essentially all of which embed at least a decade of experience. Even full-length books--an outstanding one on Tcl/Tk just hit the bookshelves--can cover only a fraction of what there is to know.

The conclusion? Choice of a GUI toolkit is complex. Every toolkit has a lot to recommend it, and every one has defects. You're only deceiving yourself if you think you've found the absolute best. What we can do, though, is talk meaningfully about the situations where different ones shine, and how to make the best use of each toolkit in different circumstances.

While I'm not surprised that Tk correctly handles the font measurements BIOSPUD describes, I certainly wasn't aware of the specific comparison that seems so important to him. I'm insensitive to a lot of the visual details on which others focus. My favorite GUI applications go into factories (for baking bread, blending gasoline, building ships, ...) where the emphasis is on software that will run for ten years without disturbance, rather than tracking this season's visual style. While I'm happy to take advantage of alpha transparency and rounded corners and such, I spend far less time with them than I do looking for simple, light-weight, robust, predictable source.

Tk comes through for me in that regard. Tomorrow I'll return with a few code samples to illustrate what I mean. In the meantime, though, be aware that Tk is a leader in handling Unicode, that "Tk widgets look fine under Windows", and that Tk's underlying Tcl base has plenty to recommend it, including:

  • special security facilities;
  • clever networking and concurrency interfaces, strong enough to inspire imitation by such new projects as Go;
  • outstanding portability; and
  • convenient licensing

which are crucial for me.

2 comments

    Anonymous 2 years ago
    GHD
    Anonymous 2 years ago
    It's called "Tile" and ships with 8.5 and 8.6http://wiki.tcl.tk/tile

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      SoftwareWhite Papers & Webcasts

      White Paper

      Best Practices Guide: Microsoft Exchange 2010 on VMware

      This guide provides best practice guidelines for deploying Exchange Server 2010 on vSphere.

      White Paper

      Free Trial: vRanger, the Powerful VMware Recovery Solution

      When disaster strikes, don't waste hours and dollars recovering critical data. vRanger delivers blazing-fast speed and granular recovery for your VMware applications and data. Get your free trial today.

      White Paper

      Executive Guide to Business and Software Requirements

      This paper is designed as an executive briefing on the issues surrounding business and software requirements. It features a wealth of statistics and tactics to help you get requirements right, and includes a tear-out single page summary.

      White Paper

      How to Launch a Successful IT Automation Initiative

      Corporations across all industries are under increasing pressure to cut costs and work more efficiently. In the race to meet both of these requirements, many organizations turn to technology, often purchasing and installing disparate pieces of software in hopes of achieving efficiencies not afforded by manual systems.

      White Paper

      Why Corporations Need to Automate IT Systems Management

      With corporate budgets being slashed and leaders expecting more out of their employees, companies are forced to do more with less, yet are still expected to provide the highest quality experience to customers. This is pushing them to make better use of their IT assets without breaking the budget. Companies are under more pressure than ever, thanks to data management regulations; increasingly complex security threats; and growing demand from management and end users for 24/7 uptime and high performance. These hurdles require a strategic investment in technologies that boost efficiency, save money and position IT as an integral part of the entire firm's operations. IT systems management is helping corporations fill these gaps.

      See more White Papers | Webcasts

      Ask a question

      Ask a Question