Good-looking Tk

Game engine illustrates toolkit advantages

By Cameron Laird  1 comment

Tk looks good. I've had a lot of conversations over the last week, in response to the earlier entries, "Tk is my favorite toolkit" and "Take advantage of Tk", in this series on the toolkit. I recognize there are sincere people who truly find it unsatisfying or even "ugly". After looking over the evidence this week, though, I just don't get it: Tk looks fine to me.

Let's wrap up the current dialogue on Tk for now with a few graphical examples. Then I'll explain a bit of my philosophy in graphical user interface (GUI) work with illustrations from Tk, which also will serve as a foundation for next week's series on my other favorite GUI toolkit. Keep your comments coming; I'm likely to return to the subject of Tk early in 2010, and, in the meantime, I'll answer specific questions in the comments below.

Good-looking graphics

What do I mean when I praise Tk's appearance? Steve Havelka's Brick illustrates my point nicely. Brick is an engine for lo-fi video games; it's not designed to stun you with breath-taking animation or subtle ray-tracing (although it probably could be extended in those directions). Brick is impressive, though, in achieving pleasing effects with just a few lines of code. It makes prototyping a complete game a realistic project for an evening.

Tk's expressivity also helps with basic widgetry. As best I can tell, many of Tk's critics are looking at old, old applications; they completely miss out on the theming that Tk has enabled for several years.

GUI intelligence

Much of my own attention in working with GUIs, as I've already mentioned, goes to what I call "intelligence", or, if you prefer, "civility". A good GUI should adjust in real time to be a good partner to the human user trying to make the most out of it. "Graying out" (disabling) selections that don't make sense at the moment is intelligent; teasing a user with menu choices, only to tell him or her, "you don't have permission to view this now", is simply rude.

While this general idea of interface intelligence is now common in development circles, far less well-known are Tk's tags and traces, constructs which are almost unique to Tcl, but powerful in expressing and programming the flexibility and intelligence a good GUI should have. Also, Tk's "everything is a string" basis encourages everything to be exposed as programmable, in a way that often seems a challenge for object-oriented styles. If there's interest, "Smart Development" might explore more of the declarative possibilities for GUI work through such a different foundation as Flapjax.

Conclusion

I emphasize a final time: you can find out how good Tk feels for yourself in only a few minutes. If you're at a Mac OS keyboard, Tk is already installed, and the same is true for most Linux distributions; even under Windows, installation of everything you need to get started only takes a single quick download.

Tk isn't unique, of course; there's plenty to like about Qt and several other toolkits. Next week, starting tomorrow, I'll explain why we're at a particularly exciting time for development of Web-based applications with HTML5.

1 comment

    Anonymous 2 years ago
    I started with TK when I learned python a year or so back. I liked it, but by god was it ugly. I started learning GTK+ and I have to tell you I hate the nutty complexity of it. I tried QT but I hate how everything looks and feels like a kids toy. I like things to look professional, like you can get things done with them. Now that I know you can theme TK to make it look like something other than Windows 3.1/95 I will definitely be going back to Python with TK. Thanks a million friend.

      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

      DevelopmentWhite Papers & Webcasts

      White Paper

      HP NonStop SQL Fundamentals whitepaper

      This whitepaper offers a detailed look into the fundamentals of HP NonStop SQL solutions. See how this system delivers unprecedented levels of application availability with fail-safe data integrity and meets the needs of enterprises with large-scale business critical applications.

      White Paper

      Nebraska Medical Center case study

      See how the Nebraska Medical Center implemented a SQL solution to make information more readily available to streamline operations, improve patient care and facilitate medical research with an enterprise solution running on HP NonStop servers.

      White Paper

      Concepts of NonStop SQL/MX

      For DBAs and developers who are familiar with Oracle solutions and want to learn about NonStop SQL/MX, this whitepaper provides an overview of the similarities and differences between the two products-with a specific focus on implementation.

      White Paper

      6 Things Your CIO Needs to Know About Requirements

      If your organization is not predictably successful on technology projects, there is likely an issue in requirements. CIOs must take action and own requirements maturity improvement. There are 6 main things a CIO must know about requirements.

      Webcast On Demand

      User Experience Monitoring

      In this webinar, you will learn hints & tips for improving end-user response times from Forrester Research analyst, Jean-Pierre Garbani.

      Sponsor: Nimsoft

      See more White Papers | Webcasts

      Ask a question

      Ask a Question