madhuri vio wrote:
this is the code i have written ..even after changing d module name
i am still getting the same error...
what do they mean by an attribute error...can u explain in detail i am
unable to
proceed further...
#!usr/bin/env python
#making structured graphics using tkinter interface....
import tkinter
a = tkinter.Tk() #initialize tkinter
and g$
a.title("madhuri is a python")
canvas = tkinter.Canvas(a) #creating the canvas
unde$
canvas.pack() #to call the packer
geome$
canvas.create_rectangle(20,10,120,80,fill=colors[0])
a.close()
and the error is ....
$ python madhu.py
Traceback (most recent call last):
File "madhu.py", line 4, in <module>
import tkinter
File "/home/manoj/tkinter.py", line 6, in <module>
root = tkinter.Tk() #initialize tkinter and get a top level instance
AttributeError: 'module' object has no attribute 'Tk'
its a lil urgent please
The original post was a reply to the digest, and you understand why that
was a mistake. But once you've created a new thread, you *DO* need to
stick with it, using Reply-All to keep the responses in one place.
As Chris says, you didn't rename the module. You still have a file
called tkinter.py in your home/monoj directory. Probably, you copied
the module,. instead of renaming it. So remove the one you're not
using, and you'll get past this problem.
The point is that the import is finding that module, rather than the one
in the library, and everything else follows from that.
DaveA
--
http://mail.python.org/mailman/listinfo/python-list