[newbie] struggling wth tkinter

Terry Reedy tjreedy at udel.edu
Sat Dec 7 16:11:35 EST 2013


On 12/7/2013 1:12 PM, Dave Angel wrote:
> On Sat, 7 Dec 2013 08:52:08 -0800 (PST), Jean Dubois
> <jeandubois314 at gmail.com> wrote:
>> I'm trying to go through a tutorial on tkinter which has the code
> below as an example. The only thing I see when running it is a little
> popup with "Click mouse here to quit" which works as expected but always
> shows the following error-message.
>> However the "main" window which should let you enter the numbers is
> not shown.
>> This is the quit error message:
>> Traceback (most recent call last):
>>   File "./feet2meters.py", line 3, in <module>
>>     from tkinter import ttk
>> ImportError: cannot import name ttk

That is supposed to work.

>> This is the code:
>> #!/usr/bin/env python
>> from tkinter import *
>> from tkinter import ttk
>
> Thanks for supplying the complete traceback.  But you should also tell
> the python version and what OS.  I'll guess python 3.3 on Linux.
>
> Finally,  what version tk are you running?  These widgets were
> introduced in tk 8.5

In 8.4, they were in the Tile extension. I do not know if that will 
work. Better, probably, to upgrade.
>
> Since it failed on the second import, none of the rest of the code
> matters. However, since you're not running it from a terminal window,
> it's conceivable that your ide is affecting the result.

Until you are able to import ttk, I believe you could remove the import 
and all 'ttk.' appearances, as I do not see anything ttk-specific.


-- 
Terry Jan Reedy




More information about the Python-list mailing list