[Tutor] Multiple tabs using tkinter

Zachary Ware zachary.ware+pytut at gmail.com
Tue Feb 7 11:41:43 EST 2017


On Tue, Feb 7, 2017 at 3:56 AM, Alan Gauld via Tutor <tutor at python.org> wrote:
> On 07/02/17 03:31, Zachary Ware wrote:
>
>> ttk rather than Tix; Tix is unmaintained and soft-deprecated in 3.6+.
>
> Really? Thats a pity.
> Tix was supposed to be the module with the extra widgets
> and ttk was purely the themed versions of same. Its a shame
> to confuse their purposes.

Full disclosure, I've never actually used Tix beyond making it build
with the rest of CPython on Windows and making sure it actually worked
on one of my Linux buildbot workers.  I have only ever seen it as a
maintenance headache :)

I have used tkinter and specifically ttk quite a bit, though, and
never felt like anything that was present in Tix was missing from ttk.

> OTOH it does mean that the full range of widgets should
> hopefully appear in ttk. Does that also mean that ttk
> is now a full superset of Tkinter like Tix? (ttk used
> to be a subset so you had to import both...)

There are some things that still need to be imported from tkinter
rather than tkinter.ttk; tkinter.ttk is mostly just the themed widgets
and style manipulation stuff, whereas support functions/constants/etc.
are in tkinter.  My usual idiom is

   import tkinter as tk
   from tkinter import ttk

but it's also possible to do "from tkinter import *; from tkinter.ttk
import *" if you like the star import idiom for tkinter.

>> Tk, and also looks significantly more native than classic Tk or Tix.
>
> Sure that was its original purpose.
>
>> Tix is also less available on platforms other than Windows,
>
> Really? I've used it on Windows and Linux.
> Where is it missing? - MacOS?

"Less available" rather than "unavailable" :).  Tix ships with Tcl/Tk
with CPython on Windows; on Linux, you'd need to install it separately
from Tcl/Tk and python/tkinter.  I honestly don't have a clue how
you'd get it on macOS or any other platform that doesn't provide it in
a system repository.

> You may finally have just given me a motivation to move to
> Python 3.6 from 3.4... :-)

Not much has changed between 3.4 and 3.6 in tkinter-land, but I'd
still recommend the upgrade anyway.  Many nice new features in 3.5 and
3.6 :).

-- 
Zach


More information about the Tutor mailing list