No ttk in 2.7

Sturla Molden sturla.molden at gmail.com
Thu May 21 10:04:18 EDT 2015


Zachary Ware <zachary.ware+pylist at gmail.com> wrote:

> The way I would do it is as follows:
> 
>    try:
>        import tkinter as tk
>        from tkinter import ttk
>    except ImportError:
>        import Tkinter as tk
>        import ttk
> 
> If I may suggest, just write it in Python3 first, then when it does
> what you want tack on whatever you need to make 2.7 happy.  I find it
> easier to do things that way, though you may find that the only thing
> you have to adjust is the imports.

This is a good advice.

And yes, it is easier than most would think.


Sturla




More information about the Python-list mailing list