No ttk in 2.7

Cecil Westerhof Cecil at decebal.nl
Wed May 20 14:51:49 EDT 2015


Op Wednesday 20 May 2015 18:43 CEST schreef Ned Batchelder:

> On Wednesday, May 20, 2015 at 12:35:40 PM UTC-4, Cecil Westerhof wrote:
>> I want to start playing with tkinter, but there are some
>> differences between 2 and 3. For this I use at the moment the
>> following code: import sys
>>
>> if sys.version_info[0] < 3:
>> import Tkinter as tk
>> import ttk
>> else:
>> import tkinter as tk
>> from   tkinter import ttk
>> or can it better be done in another way?
>
> Are you sure you want this program to run under both 2.x and 3.x?
> That will add a layer of complexity to your project. If your
> goal is to learn how to use Tkinter, you might be better off just
> picking one version of Python, and sticking with it.

I just started with Tkinter and I thought this was the only
difference. But I could be wrong of-course. ;-)


> Deciding what versions of Python to support is not always a simple
> decision.  It should be based on a realistic assessment of who will
> be using your program, and what requirements they will have.

Certainly. In principle I want to work with 3, but not all libraries
work with it. (That is also why I choose Tkinter, that works with
both. wx only with 2.)

Also, in the Netherlands mostly Python 2 is used (as far as I know),
so it is good to have my code working with both from that perspective
also.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list