[Tkinter-discuss] How does Python's new ttk (Title) support work under Linux Qt and GTk?

Michael Lange klappnase at web.de
Fri Oct 29 20:16:35 CEST 2010


Hi,

Thus spoketh python at bdurham.com 
unto us on Fri, 29 Oct 2010 12:31:49 -0400:

> Any comments on the concerns about ttk portability to Qt and GTk 
> windowing systems?
> 
> The following is from a recent thread on the python-list mailing list.
> 
> > Tkinter is built-in and available on Windows, Mac, and Linux. If
> you're using Python 2.7 or 3.1 you can take advantage of Tkinter's ttk
> (Tile) support for platform native user interfaces.
> 
> Reponse: 
> 
> You get a native UI using the correct theme even on Linux under Qt or 
> GTk?
> 
> >From what I've read of ttk, it still isn't using native UI elements.
> It just has a bunch of its own "themes" that look mostly/sort-of like
> native UI elements. Right?
> 

In the linux world (or, more correctly, on X) there actually is no such
thing as a "native" Gui appearance (what comes closest to a native X
appearance is probably the extremely simple look of some apps that come
with X by default, like xvidtune and xedit, but you surely would not want
this for ttk :). I guess what you probably mean by "Qt and Gtk windowing
systems" are the KDE and Gnome desktop environments . There is no way for
ttk to detect if one of these or some other Desktop/WM is running and
read out its themeing information. Considering how many versions of
KDE/Gnome/Xfce/whatever_else are around it seems (at least to me) quite
sensible to not even try. Tix used to try something like that, and IIRC
it never worked really reliable.

The "native" looking themes are "alt" in the first place, which looks
more or less similar to a simple Gtk1-theme or Win98 and "clam" which
seems to resemble another look that was used in old versions of Gtk. The
"classic" theme looks like plain Tk8.4 and "default" is something in
between "classic" and "alt". These are all of the built-in themes under
linux.
There are also a few advanced pixmap themes available at :

    http://tktable.cvs.sourceforge.net/viewvc/tktable/tile-themes/

According to

    http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/acedceb8a116b58e/ec9fb25044a68a9c

there seem to be other themes available somewhere, and there are tileqt
and tilegtk available in the Tile source CVS tree, which will allow you to
use any Qt/Gtk theme; I never tried these, though, and I don't know if
you can use them with Tk8.5 instead of Tile.

> Under Linux does ttk automagically pick the theme that looks most like
> the current Qt or Gtk theme?

No. The default will always be "default". If you want to use a different
theme, you must enable it explicitely.

> 
> On systems where both are installed, how does ttk decide whether to
> look like Qt or Gtk?

It doesn't.

> 
> In addition to looking like native UI elements, does ttk also change
> UI behaviors to match native UI elements?  For example will it
> automatically use emacs key-bindings for text-entry editing if that's
> enabled in my Gtk configuration?

I doubt that ttk will do anything like that.

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

You go slow, be gentle.  It's no one-way street -- you know how you
feel and that's all.  It's how the girl feels too.  Don't press.  If
the girl feels anything for you at all, you'll know.
		-- Kirk, "Charlie X", stardate 1535.8


More information about the Tkinter-discuss mailing list