Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90978

Re: No ttk in 2.7

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Re: No ttk in 2.7
Organization Decebal Computing
References <87r3qbqlve.fsf@Equus.decebal.nl> <5e9aac07-e210-4eb5-a3d7-cfa37cb3f6ab@googlegroups.com> <414bf0ad-557d-4373-8452-ab089888225e@googlegroups.com>
Date 2015-05-20 20:52 +0200
Message-ID <87iobnqdxi.fsf@Equus.decebal.nl> (permalink)

Show all headers | View raw


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

> On Wednesday, May 20, 2015 at 12:43:29 PM UTC-4, Ned Batchelder wrote:
>> 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.
>>
>> 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.
>>
>> --Ned.
>
> Oh, and I meant to include this: if you *do* want to support both
> 2.x and 3.x, the six module can make it easier. It helps smooth over
> modules that have been moved. You can use this line, for example:
>
> from six.moves import tkinter_ttk as ttk

Thanks for the tip. I will look into it.

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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

No ttk in 2.7 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 18:01 +0200
  Re: No ttk in 2.7 Ned Batchelder <ned@nedbatchelder.com> - 2015-05-20 09:43 -0700
    Re: No ttk in 2.7 Ned Batchelder <ned@nedbatchelder.com> - 2015-05-20 09:47 -0700
      Re: No ttk in 2.7 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 20:52 +0200
        Re: No ttk in 2.7 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-20 21:55 +0100
    Re: No ttk in 2.7 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 20:51 +0200
  Re: No ttk in 2.7 Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-05-20 12:03 -0500
    Re: No ttk in 2.7 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 20:54 +0200
      Re: No ttk in 2.7 Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-20 13:30 -0600
  Re: No ttk in 2.7 Sturla Molden <sturla.molden@gmail.com> - 2015-05-21 14:04 +0000

csiph-web