Prev: how to get a reference to the "__main__" module
Next: FREE & Just ONE Click To Obtain Success With Click2Sell.
From: Chris Rebert on 9 Jun 2010 03:09 On Tue, Jun 8, 2010 at 11:57 PM, madhuri vio <madhuri.vio(a)gmail.com> wrote: > import tkinter > > root = tkinter.Tk() #initialize tkinter and get a top level instance > root.title("madhuri is a python") > canvas = tkinter.Canvas(root) #creating the canvas under the root > canvas.pack() #to call the packer geometry > canvas.create_rectangle(20,10,120,80,fill=colors[0]) > root.close() > tk.destroy() > > > this is the program i have written and i am unable to execute it as i > get an attribute error like this... > > $ python tkinter.py > Traceback (most recent call last): > Â File "tkinter.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' > > where is the mistake and what do i do ???its a ll urgent *Don't name your module the same name as a built-in module.* Rename your /home/manoj/tkinter.py file to something else. Also, it seems that line should be "root = tkinter.Tk()" with a capital T; your actual code doesn't match the code snippet you posted. Finally, to start a new topic/thread on the mailinglist, *please don't reply to a random digest*. Follow the instructions in the digest message itself: > On Tue, Jun 8, 2010 at 3:30 PM, <python-list-request(a)python.org> wrote: >> Send Python-list mailing list submissions to >> Â Â Â Â python-list(a)python.org <actual unnecessary digest snipped> Regards, Chris -- Netiquette; sigh. http://blog.rebertia.com |