【问题标题】:The 'root.mainloop()' in Tkinter causes an AttributeErrorTkinter 中的 'root.mainloop()' 导致 AttributeError
【发布时间】:2018-12-22 14:34:34
【问题描述】:

在我的 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()

【问题讨论】:

    标签: python tkinter attributeerror


    【解决方案1】:

    你应该替换:

    root.mainLoop()
    

    root.mainloop()
    

    所有小写字母。

    【讨论】:

    • 谢谢,当我制作这样的愚蠢错误时,我讨厌它。 span>
    猜你喜欢
    • 2014-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多