Meaning of “AttributeError: NoneType object has no attribute tk”?

前端 未结 3 1591
执笔经年
执笔经年 2020-12-21 05:11

What does the following error message mean?

AttributeError: \'NoneType\' object has no attribute \'tk\'
3条回答
  •  醉酒成梦
    2020-12-21 05:31

    I have had this problem but found the solution. This problem arises when you declare the variable before you make an instance of Tk().

    For example, this will bring the error

    count = IntVar()
    ....
    ....
    app = Tk()
    

    Solution!! Make the declarations after creating a tkinter application window

    app = Tk()
    ....
    count = IntVar()
    

提交回复
热议问题