Python/Tk not working in Linux

BinnyVA binnyva at gmail.com
Fri Aug 11 23:44:08 EDT 2006


I am using Fedora Core 3 Linux and I have a problem with Tk in Python.
Whenever I try to run a tk script, I get the error...

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

I get this error with even the most basic Python/Tk scripts like

---------------
from Tkinter import *

class Application(Frame):
	def createWidgets(self):
		self.lab = Label(text="Hello World")
		self.lab.pack()

	def __init__(self, master=None):
		Frame.__init__(self, master)
		self.pack()
		self.createWidgets()

app = Application()
app.mainloop()
------------------

However python script that does not used Tk works fine.

I have tried to solve this problem by reinstalling Python from source -
but still no luck. Ruby also fails this way in my system - ruby works -
but not Ruby with Tk. However Perl/Tk and Tcl/Tk works fine.

Any suggestions?

--
Binny V A
http://www.bin-co.com/perl/perl_tk_tutorial/ - Perl/Tk
http://www.bin-co.com/tcl/tutorial/ - Tcl/Tk




More information about the Python-list mailing list