Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The 'root.mainloop()' in Tkinter causes an AttributeError

In my python code the root.mainloop() line causes the error:

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

I am on Mac and my code is:

from tkinter import *
root = Tk()
myLabel1 = Label(root, text = 'My First GUI')
myLabel1.pack()
root.mainLoop()
like image 734
Conor Matthews Avatar asked Dec 03 '25 23:12

Conor Matthews


1 Answers

You should replace :

root.mainLoop()

with

root.mainloop()

all in small case letters.

like image 155
Reblochon Masque Avatar answered Dec 07 '25 06:12

Reblochon Masque