Making Tk applications a bit less ugly

Ever had that one application you found too useful to replace, but it looked like a refugee from 1989? Chances are the application is written using either Motif or Tk and, while I can’t help you poor souls with in-house Motif applications, I can help you beautify your Tk applications like git gui and idle.

As of Tk version 8.5, a new variation on the widget API known as Ttk (themed Tk, formerly Tile) has become available and every Tk-using application I’m aware of has been quick to adjust for compatibility.

Users of Ttk on Windows and MacOS X should already have the Ttk native theming engines enabled, but since they’ve had pretty native-looking theming even before Ttk, they’re not my concern.

Users of Linux, FreeBSD, and other non-Windows, non-OSX desktops will be running a Ttk theme named “default” which, while not as ugly as “classic”, still reeks of the old motif design aesthetic and, frustratingly, there is no “native theme” engine for X11 desktops. (The TkTable guy did write tile-gtk and tile-qt engines, but they haven’t been updated to build against current Ttk… at least on my system)

Thankfully, we’re not completely out of options. Ttk includes a theme named “clam” based on an older version of Xfce’s GTK+ theme. It’ll only get you to “refugee from 1999”, but a decade’s jump for one line of config file isn’t too bad.

Just add *TkTheme: clam to your ~/.Xresources and run xrdb -merge ~/.Xresources to apply it without logging out.

Also, if anyone knows what happened to the Plastik and Keramik themes shown on the Tile website, please let me know. They still wouldn’t fit with stuff like Canonical’s Human theme, but they’d be closer than clam.

UPDATE: I’ve found a Clearlooks pixmap theme that I’m now using instead.

CC BY-SA 4.0 Making Tk applications a bit less ugly by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

6 Responses to Making Tk applications a bit less ugly

  1. Pingback: Installing a new Ttk/Tile theme | Stephan Sokolow's Blog

  2. Nick says:

    Great post! I’ve been looking for some how-to guide for quite some time. The clearlooks theme works great on my Gentoo box.

  3. Martin says:

    For the record, you can set this in your application with:

    s = ttk.Style()
    s.theme_use(‘clam’)

    This way you don’t place the burden on the user 😉

    • And now your application will look out of place and frustrate the user if they want something else like the Clearlooks pixmap theme from PySolFC.

      You can do something similar in GTK+ too but it’s rare to see it done these days for the same reason.

  4. Jasa Konveksi says:

    What’s up, Iwant to subscribe for this weblog too take most recent updates, therefre where can i do it please help.

    • In case you’re a spambot, I’ve removed the link from your post. However, since you could just be someone who only knows how to use “subscribe via e-mail”, I’ll leave your comment up.

      To answer your question, you can use the “Entries RSS” link in the sidebar and, if you don’t have an RSS reader, you can google up services which convert RSS feeds into e-mail notifications.

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.