Yanxi
Yanxi

Reputation: 21

AttributeError: '_tkinter.tkapp' object has no attribute 'mainloop'

from tkinter import *

root = Tk()

#creating a label widget
myLabel = Label(root, text="Module selection")
#displaying it on the screen
myLabel.pack()


root.mainLoop()

so I'm just watching this very simple tkinter tutorial video https://www.youtube.com/watch?v=YXPyB4XeYLA

and I'm already getting this error. I followed his steps exactly. Is this code out of date?

Upvotes: 0

Views: 1376

Answers (1)

DaVinci
DaVinci

Reputation: 879

You just used camelcase for the mainloop()

from tkinter import *

root = Tk()

#creating a label widget
myLabel = Label(root, text="Module selection")
#displaying it on the screen
myLabel.pack()


root.mainloop()

Upvotes: 2

Related Questions