Sublime Forum

Help with importing Tkinter

#1

Sorry… big noob here

I want to start programming GUI applications with Tkinter.

I use this to import it:

from tkinter import *
root = Tk()
root.mainloop()

but the console just outputs:

Traceback (most recent call last):
  File "D:\Python Files\tkinter.py", line 1, in <module>
    from tkinter import *
  File "D:\Python Files\tkinter.py", line 2, in <module>
    root = Tk()
NameError: name 'Tk' is not defined

can anyone help a noob out?

0 Likes

#2

I guess if you import tkinter then do a print(dir(tkinter)) you could see what is available, in case it helps

1 Like