Tkinter 中的 'root.mainloop()' 导致 AttributeError

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

在我的 python 代码中,root.mainloop() 行导致错误:

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

我在 Mac,我的代码是:

from tkinter import *
root = Tk()
myLabel1 = Label(root, text = 'My First GUI')
myLabel1.pack()
root.mainLoop()

你应该替换:

root.mainLoop()

root.mainloop()

全部为小写字母。