Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; '16,': 0.03; 'importerror:': 0.05; 'installed.': 0.05; 'svn': 0.05; 'sys': 0.05; 'tkinter': 0.07; 'python': 0.09; '2to3': 0.09; 'imports': 0.09; 'path.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tcl': 0.09; 'tcl/tk': 0.09; 'terry': 0.09; 'looked': 0.10; '2.7': 0.13; 'file,': 0.15; '__init__.py': 0.16; 'fixes.': 0.16; 'frame,': 0.16; 'helps.': 0.16; 'importable': 0.16; 'path).': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'renamed': 0.16; 'subject:import': 0.16; 'traceback.': 0.16; 'wrote:': 0.17; 'package.': 0.17; 'jan': 0.18; '>>>': 0.18; 'windows': 0.19; 'module': 0.19; 'bit': 0.21; 'import': 0.21; 'error.': 0.21; 'button,': 0.22; 'installation': 0.23; "i've": 0.23; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; '(most': 0.27; 'header:X-Complaints-To:1': 0.28; 'included': 0.29; "i'm": 0.29; 'becomes': 0.30; 'checked': 0.30; 'code': 0.31; 'file': 0.32; 'running': 0.32; 'traceback': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'pm,': 0.35; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'others.': 0.36; 'should': 0.36; 'does': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'possible.': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'latest': 0.61; 'show': 0.63; 'note:': 0.64; 'here': 0.65; 'else.': 0.65; 'article': 0.78; '8.4': 0.84; 'have?': 0.84; 'received:fios.verizon.net': 0.84; 'articles,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: import of ttk Date: Sat, 05 Jan 2013 17:29:51 -0500 References: <50E7A5EC.9080203@gmail.com> <50E87D3C.4090401@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <50E87D3C.4090401@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357425040 news.xs4all.nl 6866 [2001:888:2000:d::a6]:41234 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36218 On 1/5/2013 2:21 PM, Verde Denim wrote: > On 01/04/2013 11:39 PM, Terry Reedy wrote: >> On 1/4/2013 11:02 PM, Verde Denim wrote: >>> In reading through one of the learning articles, I have a bit of code >>> that imports ttk, but I apparently don't have this installed. I've >>> looked up the svn checkout for python-tk, and have checked it out >>> (read-only), but still get the same error. I'm running 2.6.6 python, if >>> that helps. Upgrade to the latest 2.7 or even 3.3 if at all possible. >> Show the line of code that did not work and the traceback. What system >> are you running on and what tcl/tk installation does it have? ttk is >> included with any 8.5 installation. tile is often included with 8.4 >> installations and should be picked up as well. >> >> The article I'm looking at is here - >>> http://www.zetcode.com/gui/tkinter/introduction/ >> >> > The line is - > 16 from ttk import Frame, Button, Style > > $ python tkinter_tut1.py > Traceback (most recent call last): > File "tkinter_tut1.py", line 16, in > from ttk import Frame, Button, Style > ImportError: No module named ttk > > I'm running on Debian Squeeze, and do show both 8.4 and 8.5 of tcl On my Windows 2.7 installation, directory /Lib contains directory /lib-tk (which is added to the path). /lib-tk contains files Tkinter.py and ttk.py, among others. If you have ttk.py, then I do not think you should get that specific message; if there were a problem finding tcl/tk, it should say something else. If you do not have that file, as it seems, then your installation is incomplete. So check your /Lib/lib-tk. If you do not know where it is import sys print(sys.path) Portability note: In 3.x, /lib-tk was renamed /tkinter and removed from the path. Tkinter.py was renamed __init__.py to make the renamed /tkinter an importable package. So 'import Tkinter becomes 'import tkinter', while 'import ttk', etcetera, is now 'import tkinter.ttk', etcetera. 2to3 should make the fixes. -- Terry Jan Reedy