Python tk() error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python tk() error

i tired python Gui. Since I'm on Python 3.7.4, tkinter must be already installed. and I wrote my first Code. """ from tkinter import * window = tk() label = label(window, text = 'hello world!').pack() window.mainloop() """ but I'm getting this error """ NameError: name 'tk' is not defined """ Please help how to resolve...

15th Jan 2020, 6:43 AM
Mantavya Sharma
Mantavya Sharma - avatar
1 Answer
+ 1
window = Tk() The name of the class is Tk, not tk. Also the label class, it's supposed to be Label.
15th Jan 2020, 8:25 AM
Danigamy
Danigamy - avatar