-2

I was trying to built a small window with tkitner and it showed up this error

Traceback (most recent call last):
  File "E:\education\python\example .py", line 3, in <module>
    master = TK()
NameError: name 'TK' is not defined
from tkinter import *

master = TK()
master.mainloop()
Or Y
  • 2,088
  • 3
  • 16

1 Answers1

2

It's not TK(), its Tk() (Small k).
Also, using from ... import * is dangerous and should be avoided.

Or Y
  • 2,088
  • 3
  • 16
  • 1
    very thanks i have been fighting with this for 3 days an why from ... import * is dangerous – ahamed sha Sep 07 '20 at 05:40
  • 2
    @ahamedsha You can check the link which has an answer with the most important reasons for why this is dangerous but in a short answer - You don't know what you've just imported into your namespace – Or Y Sep 07 '20 at 06:35