No ttk in 2.7

Ian Kelly ian.g.kelly at gmail.com
Wed May 20 15:30:12 EDT 2015


On Wed, May 20, 2015 at 12:54 PM, Cecil Westerhof <Cecil at decebal.nl> wrote:
> Op Wednesday 20 May 2015 19:03 CEST schreef Zachary Ware:
>> try:
>> import tkinter as tk
>> from tkinter import ttk
>> except ImportError:
>> import Tkinter as tk
>> import ttk
>
> When there goes something wrong with:
>     from tkinter import ttk
> you will not understand what is happening. ;-)

If something goes wrong with the first import and raises an
ImportError, then it will execute the except clause, which will
definitely raise an ImportError. In this case the second error will
simply be chained onto the first, so the details of the first error
won't be lost.



More information about the Python-list mailing list