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()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…