Reputation: 13
I am quite new to Python, but know the basics. I have been watching a few tutorials about Tkinter
, but even from the start when I type:
from Tkinter import *
root = Tk()
It gives me the error:
>Traceback (most recent call last):
File "/Users/$Name/Desktop/PycharmProjects/untitled/Tkinter.py", line 1, in <module>
from Tkinter import *
File "/Users/$Name/Desktop/PycharmProjects/untitled/Tkinter.py", line 3, in <module>
root = Tk()
NameError: name 'Tk' is not defined
I've tried different things, and I have used IDLE
, and it still does not work. I am also on Mac OS X El Capitan if that should matter.
Upvotes: 0
Views: 4576
Reputation: 42758
You named your file Tkinter.py
. So you are importing your own file. Rename your python file, delete Tkinter.pyc
and try again.
Upvotes: 5