[Tutor] idle or lack thereof ...

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue Dec 31 14:03:37 2002


On 31 Dec 2002, ahimsa wrote:

> I'm sorry to keep going on about this idle, but I must be having a brain
> fugue or some such 'cos I seem to be having a really hard time figuring
> this out.

Hi Ahimsa,

Don't worry about it; let's try to figure out what's happening.


> I followed up on a suggestion and found 'idle' buried within the Tools
> sub-directory. When I went to go and call it this is the output.
>
> [ahimsa@localhost ahimsa]$ /usr/lib/python2.2/Tools/idle/idle.py
> Traceback (most recent call last):
>   File "/usr/lib/python2.2/Tools/idle/idle.py", line 3, in ?
>     import PyShell
>   File "/usr/lib/python2.2/Tools/idle/PyShell.py", line 13, in ?
>     from Tkinter import *
>   File "/usr/local/lib/python2.2/lib-tk/Tkinter.py", line 35, in ?
>     import _tkinter # If this fails your Python may not be configured
> for Tk
> ImportError: No module named _tkinter


Ah, I see.  It looks like you're using a locally-compiled version of
Python.  You may want to check if you have a library called "Tcl/Tk"
installed on your system.  The _tkinter module is an extension that makes
Tcl/Tk graphics libraries available to Python, and that error message is
saying that it can't find the graphics library.  Tkinter is a graphics
toolkit library that it uses to display the windows of IDLE, so that's why
it's a prerequisite.


You'll want to look to see if the 'development' stuff for Tcl/Tk is
installed with your system.  On a Debian Linux system, for example, the
package 'tk8.3-dev' is the one you'll want to install.  Once you've found
and installed the development packages, a recompile of Python should
autodetect the graphics library.

I'm only guessing that you're using a Linux though; what kind of Unix
distribution are you using?


Good luck to you!