Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linux / Python 2.5 / Tkinter  Will not import Tkinter

Posted on 2007-04-10
3
Medium Priority
?
862 Views
Last Modified: 2013-12-15
I am having trouble Making Python Tcl/Tk work on Linux.  I have mandrake linux 10.0 installed on my machine..  and I also have a Python Program that Import Tkinter .  Anyway when I try I get this message

Traceback (most recent call last):
  File "AllTk.py", line 1, in <module>
    from Tkinter import *
  File "/usr/local/lib/python2.5/lib-tk/Tkinter.py", line 38, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

and here is the import statement I am using

from Tkinter import *

/usr/local/lib/python2.5/lib-tk/Tkinter.py does exist.  when I run python Tkinter.py I get the same error.

I am definately running the 2.5 binary  already checked that.  So I'm not sure what is going on.  it seems
obvious that Python 2.5 comes preloaded with Tkinter.  So why doesnt it work?

Any help would be appreciated.  Thanks
scog
0
Comment
Question by:scogger1974
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Author Comment

by:scogger1974
ID: 18885312
It seems obvoius that  

/usr/local/lib/python2.5/lib-dynload/_tkinter.so   does not exist.  But how do i get it there... I've tried installing Tcl and Tk 8.4  Tcl installs fine... Tk has errors....

Thanks
0
 
LVL 1

Accepted Solution

by:
akameswaran earned 1500 total points
ID: 18942123
You would think TKinter is standard, but it is not on many Distros.  I don't run Mandrake.  But a lot of distro's do not include TKinter with their basic python packages.  I would check for additional packages probably looking more for packages.

For development I always build my python environment separate from the one included with the distro.  there are multiple reasons.  The one that might help here is not fighting through package dependencies when building from source is pretty easy and straightforward.

If TK is not installing properly that will definitely be an issue.

On a separate note - have you looked at wxPython?  It's another x-platform GUI toolkit.  I stopped using Tkinter about  2 years ago as it is quite primitive.  wxPython has it's faults - but it is more robust and is quite active.  I tend to look back at the time I spent learning Tkinter(mostly forgotten by now) as wasted time.  If you go this route - definitely build your own wxPython - the build instructions are complete enough, and I've yet to see the distro that provides any reasonably modern version of wxPython in it's packages.

I am trying to recall, but I think the packages to hookup python to Tkinter tend to be additional packages for python (not tk or tcl)  

I know it's not a full answer - but maybe it'll help you get moving.
0
 
LVL 1

Author Comment

by:scogger1974
ID: 18958083
once I got on a ssytem that had yum.  I installed all tkinter packages available and it seemed to do the trick.   thanks for the comment.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question